Tuesday, February 19, 2013

Convert LONG data types to LOBs

rem -----------------------------------------------------------------------
rem Filename:     conv2lob.sql
rem Purpose:      Convert LONG datatypes to LOBs (Large Objects)
rem Dependancies: Oracle 8.1.x or higher
rem Date:         17-Sep-2001
rem Author:      
rem -----------------------------------------------------------------------
create table old_long_table(c1 number, c2 long);
insert into  old_long_table values (1, 'LONG data to convert to CLOB');
create table new_lob_table(c1 number, c2 clob);
-- Use TO_LOB function to convert LONG to LOB...
insert into  new_lob_table
       select c1, to_lob(c2) from old_long_table;
-- Note: the same procdure can be used to convert LONG RAW datatypes to BLOBs.

No comments:

Post a Comment