getting string literal is too long while inserting clob data in table

srikotesh
srikotesh used Ask the Experts™
on
Hi Experts,

I trying insert a record in a table.
table having clob value for one column.

I have copied this clob value from the existing record of a table.
same clob value trying to insert

I am getting the error string literal is too long

how to resolve.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
you can't do it with a literal as part of the sql statement but use a bind variable instead.  bind your parameter correctly for long data, for example SQL_LONGVARCHAR and not SQL_VARCHAR.

Sara
Most Valuable Expert 2012
Distinguished Expert 2018
Commented:
For one-time things, I use a PL/SQL block.  You just need to break up the value into smaller chunks less than 4000 characters.

Something like this:
declare
	myClob clob;
begin
	myClob := myClob || 'Hello';
	myClob := myClob || ' World';
	insert into myTable values(myClob);
end;
/

Open in new window

awking00Information Technology Specialist

Commented:
>>I have copied this clob value from the existing record of a table<<
What are the data types of the existing and the column you want to insert? What was the command you tried?

Author

Commented:
thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial