0

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.

2 Answers 2

1

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
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.