Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting data to a CLOB type in oracle

Tags:

oracle10g

i have created a table

create table test_clob(
  value clob
);

if i try to do an insert on this table with the data size grater than 4000 bytes i get following error

SQL Error: ORA-01704: string literal too long
01704. 00000 -  "string literal too long"
*Cause:    The string literal is longer than 4000 characters.
*Action:   Use a string literal of at most 4000 characters.
           Longer values may only be entered using bind variables.

I don't how to use the bind variables...

like image 921
dsm Avatar asked Oct 27 '25 00:10

dsm


1 Answers

You can use to_clob function to insert large text in oracle database. Example like:String have more then 4000 char.then use query:

insert into tableName(fieldName)values(to_clob('charCount=>4000')||to_clob('after 4000 char but not more then 4000'));

Ex: if I have 6000 char then 4000 in first to_clob and next 2000 char next to_clob:

like image 149
Rajat Kumar Avatar answered Oct 29 '25 19:10

Rajat Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!