How to insert xml file data to atble having column type as xmltype
Hello , I have a table defined as
CREATE TABLE TEST_TABLE (docid VARCHAR2(200), type VARCHAR2(200),xmlfile XMLTYPE) ;
and from java , i m trying to insert xml data as below
String query = "INSERT INTO TEST_TABLE (docid,type,xmlfile) VALUES (?,?,XMLType(?)) ";
// Get the statement Object
PreparedStatement statement = jdbcConection.getJdbcConnection().prepareStatement(query);
// Get the OracleClob instance from xmlString
statement.setString(1, "0BCFF8F0");
statement.setString(2, "Topic");
clob =(OracleClob) jdbcConection.getJdbcConnection().createClob();
clob.setString(1, "am new to xml db");
statement.setObject(3, clob);
// Execute the prepared statement
if (statement.executeUpdate () == 1)
{
System.out.println ("Successfully inserted");
}
getting the error java.sql.SQLException: ORA-22922: nonexistent LOB value