Rule Definition
The LONG data type stores character strings longer than 4000 bytes. You can store up to 2
gigabytes (2^31-1 bytes) in a LONG column. Columns of this type are used only
for
storage
and
retrieval
of long strings. They cannot be used in functions,
expressions,
or WHERE
clauses.
LONG
column values
are generally converted
to
and from character
strings.
Do
not create
tables
with
LONG columns.
Use
LOB
columns
(CLOB, NCLOB,
or
BLOB) instead.
LONG
columns are
supported
only
for backward
compatibility.
Oracle
also
recommends
that
you
convert existing
LONG columns
to
LOB columns. LOB columns
are subject
to
far
fewer
restrictions
than LONG
columns.
Furthermore,
LOB functionality
is enhanced
in every
release,
but
LONG
functionality
has been static for
several
releases.
LONG
RAW columns
should
be converted
to
BLOB
type columns.
Remediation
Convert LONG and LONG RAW to LOB.
Violation Code Sample
CREATE TABLE Long_tab (id NUMBER, long_col LONG);
Fixed Code Sample
ALTER TABLE Long_tab MODIFY ( long_col CLOB );
Reference
https://docs.oracle.com/cd/E11882_01/appdev.112/e10646/oci03typ.htm#LNOCI16290
https://docs.oracle.com/cd/B28359_01/appdev.111/b28393/adlob_long_lob.htm#i1006094
Related Technologies
Technical Criterion
CWE-477 - Use of Obsolete Function
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.