Inserting into clob, data more than 4000 chars via pl/sql [message #280497] |
Tue, 13 November 2007 21:39 |
orausern
Messages: 826 Registered: December 2005
|
Senior Member |
|
|
Hi,
I have a requirement to insert an xml file into a clob and while the attached procedure does insert the file data, but it truncates the data to 4000 characters, so the entire xml file is not inserted...can you please help correct the procedure..
Regarding the table structure -the table adp_appdefinition has a single column i.e. xmldef which is a clob.
With regards,
Nirav
|
|
|
Re: Inserting into clob, data more than 4000 chars via pl/sql [message #280536 is a reply to message #280497] |
Wed, 14 November 2007 00:56 |
rleishman
Messages: 3728 Registered: October 2005 Location: Melbourne, Australia
|
Senior Member |
|
|
Show us your evidence that the table column is a CLOB:
Also show us evidence that the database column is truncated:
SELECT LENGTH(xmldef) FROM ADP_APPDEFINITION
Here's an example to show that it is possible:
SQL> create table x (a clob);
Table created.
SQL>
SQL> declare
2 c clob;
3 begin
4 c := lpad('X', 10000, 'X');
5 insert into x values(c);
6 end;
7 /
PL/SQL procedure successfully completed.
SQL>
SQL> select length(a) from x;
LENGTH(A)
----------
10000
Ross Leishman
|
|
|
|
Re: Inserting into clob, data more than 4000 chars via pl/sql [message #280586 is a reply to message #280582] |
Wed, 14 November 2007 02:49 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Script:create table x (a clob);
declare
c clob;
begin
c := lpad('X', 10000, 'X');
insert into x values(c);
end;
/
select length(a) from x;
drop table x;
I've just run it on SQL*Developer, TOAD and SQL*Plus against a 10.2.0.1.0 database and it works perfectly.
Can you show us a cut and paste of the script being run and the error (from SQL*Plus ideally)
|
|
|
|
Re: Inserting into clob, data more than 4000 chars via pl/sql [message #280607 is a reply to message #280588] |
Wed, 14 November 2007 04:07 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Ahhh....
I think the problem is that in the OPs script he is trying to assign a string value to XMLDEF, and the length of the string is about 79,000 chrs, which is too long for a string in pl/sql.
I supect that if you break that one long string into 3 smaller ones and concatenate them into XMLDEF then it should work.
|
|
|
|
|
|