Hi,
long datatypes cause chaining in Oracle.
LOB is better because it can use different storage than long data type (which is stored in table row).
In order to convert:
1) Leave the long column in the old table and add a new LOB column using the ALTER TABLE command. The ALTER TABLE command is not able to change the type of a LONG column to a LOB column. LONG and LOB columns are two distinct datatypes, so it is not possible to assign a LONG column to a LOB column.
2) Write the data in the LONG or LONG RAW to a flat file
3) Use DBMS_LOB.LOADFROMFILE() procedure
SQL> create table a (id NUMBER(10), description long);
Table created.
SQL> insert into a values (1,'one');
1 row created.
SQL> create table b (id NUMBER(10), description clob);
Table created.
SQL> insert into b select id, to_lob(description) from a;
1 row created.
SQL>
To create a copy of a table with a LONG in it do this:
SQL> create table a (id NUMBER(10), description long);
Table created.
SQL> insert into a values (1,'one');
1 row created.
SQL> create table b (id NUMBER(10), description long);
Table created.
SQL> DECLARE
2 CURSOR c_data IS
3 SELECT * FROM a;
4 BEGIN
5 FOR cur_rec IN c_data LOOP
6 INSERT INTO b (id, description)
7 VALUES (cur_rec.id, cur_rec.description);
8 END LOOP;
9 END;
10 /
Bookmarks