I have the following table containing a XMLTYPE column
create table contracts( id number primary key, contract_doc XMLTYPE) XMLTYPE contract_doc store as clob;
Now in a query to get the xml value as a VARCHAR or clob I could do the following:
SELECT c.CONTRACT_DOC.getStringVal() FROM CONTRACTS c
SELECT c.CONTRACT_DOC.getClobVal() FROM CONTRACTS c
respectively.
Also explained here
490299
However, the SQL statement is Oracle-specific. Is there another way that is database neutral ?
I have also tried "SELECT CONTRACT_DOC AS CLOB FROM CONTRACTS".
However, in my java code Clob clob = rs.getClob(i);
results in the following error message "Invalid column type: getCLOB not implemented for class oracle.jdbc.driver.T4CNamedTypeAccessor"
So far to get the XML data requires the following code:
XMLType poxml = (XMLType) rs.getObject(i);
String xmlValue = poxml.getStringVal();
which again is Oracle-specific.
Any help would be appreciated. Thanks