LONG

From Oracle FAQ
⧼orafaq-jumptonavigation⧽⧼orafaq-jumptosearch⧽

LONG is an Oracle data type for storing character data of variable length up to 2 Gigabytes in length (bigger version of the VARCHAR2 datatype). Note that a table can only have one LONG column.

History

Since Oracle 8i, Oracle advised against using the LONG datatype. Users should convert to CLOB or NCLOB types.

Example

SQL> CREATE TABLE t1(id NUMBER, doc LONG);
Table created.
SQL> INSERT INTO t1 VALUES (1, 'Test to go into LONG column');
1 row created.

Convert to newer CLOB/NCLOB type

Following from the above example, use the TO_LOB function to convert the LONG column to a CLOB:

CREATE TABLE t1_new(id NUMBER, doc CLOB);
INSERT INTO t1_new SELECT id, TO_LOB(doc) FROM t1;
DROP TABLE t1;
RENAME t1_new to t1;

Also see