Home » RDBMS Server » Server Utilities » copy the contents into CLOB datatype
copy the contents into CLOB datatype [message #72841] Fri, 14 November 2003 07:22 Go to next message
blazix
Messages: 6
Registered: October 2003
Junior Member
Hello All,

I have two tables A,B with same colnames and datatypes except one column which is varchar in table A and CLOB in table B.

Now my problem is how to copy all the rows from table A to B.
1.Insert the varchar column values into CLOB datatype
2.Insert null in CLOB for later updation.

Please post the suggestion for the 2 possiblities.
Immediate help is highly appreciated.

Thanks
blazix
Re: copy the contents into CLOB datatype [message #72872 is a reply to message #72841] Thu, 27 November 2003 05:58 Go to previous message
Frank Naude
Messages: 4587
Registered: April 1998
Senior Member
Hi,

Look at this example:

-- Create sample tables...
create table A(id number, val varchar2(4000));
create table B(id number, val clob);

-- Populate...
insert into A values (1, 'test value');
commit;

-- Copy data from A to B...
insert into B select * from A;

-- Copy data, but leave the CLOB values NULL...
insert into B select id, empty_clob() from A;

-- Look at copied data...
set NULL NULLVAL
col val format a40
select * from B;

Best regards.

Frank
Previous Topic: Select statement in SQL * Loader
Next Topic: HTML DB
Goto Forum:
  


Current Time: Tue Dec 24 21:04:38 CST 2024