How to insert a data from table1 column1 which is having a CLOB datatype with length 4708 chars into table2 column2 with varchar2(4000)?
Thank you in advance.
Well, 4708 into 4000 won't go. So you'll need to trim it.
insert into table2 (column2)
select dbms_lob.substr( column1, 4000, 1 )
from table1
In oracle < 12 there are no other option, you have to trim clob to 4000 as @APC said.
In oracle 12.++ you can use extended data type
. And change max length limit of varchar from 4000 to 32767. Switching from standard
to extended
is one-way operation. max_string_size.
After this you do simple insert from one table to another.