Oracle CLOBs, XMLDB and JDBC
From: Brad (javawork_co_uk_at_yahoo.co.uk)
Date: 03/30/04
- Next message: Abdullah Kauchali: "Re: Manufacturing a Disconnected CachedRowset"
- Previous message: Rainer Knasar: "Re: SAPDB JDBC Driver & Trace-file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Mar 2004 03:30:22 -0800
Hi all,
I'm trying to insert a row into my XMLDB table but I have the
following problem:
My xml is too big for varchar2 (>4k) so I have to use a CLOB in the
constructor for XMLType. However I can't create a new CLOB complete
with data in JDBC, so I have to create and empty CLOB and update it
later. Unfortunately this clashes with XMLDB which won't let me insert
a an empty document as it fails schema validation.
So, my workaround is to load the xml into another "staging" table and
then once the CLOB is populated, transfer it into the XMLType table.
Here's my stored procedure to do this:
create or replace procedure clobMove is
CURSOR c1 is
select xml_content
from xml_clobs
where doc_id = 'clob1';
xmlClob CLOB;
BEGIN
open c1;
fetch c1 into xmlClob;
insert into bufr_xml values(XMLType.createXML(xmlClob));
commit;
close c1;
END;
I can call this without any problems in SQL*Plus but the JDBC call
produces errors:
CallableStatement cs = conn.prepareCall("{call clobin}");
int rows = cs.executeUpdate();
SEVERE: Unable to load doc into database: ORA-22814: attribute or
element value is larger than specified in type
Any help would be very welcome.
Cheers,
Brad.
- Next message: Abdullah Kauchali: "Re: Manufacturing a Disconnected CachedRowset"
- Previous message: Rainer Knasar: "Re: SAPDB JDBC Driver & Trace-file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|