I am attempting to insert using a query in 11.2.0.3. The table is defined like this:
CREATE TABLE book_master AS TABLE OF XMLTYPE XMLTYPE STORE AS SECUREFILE BINARY;
The insert statement is structured this way:
INSERT INTO book_master
SELECT
t.invt_data
FROM
XMLTable(
XmlNamespaces('http://www.mrbook.com/InventoryData' AS "invtdata",
'http://www.mrbook.com/book' AS "book"),
'/book:BOOKS'
PASSING ?
COLUMNS
invt_data XMLTYPE PATH 'invtdata:INVT_DATA'
) t;
The parameter '?' is passed in through JDBC.
When I run this, I get the error:
Error report:
SQL Error: ORA-19010: Cannot insert XML fragments
19010. 00000 - "Cannot insert XML fragments"
*Cause: XML fragments got from extractNode cannot be inserted into the database.
*Action: Convert the fragment into a proper XML document before insertion.
Is there any way to cast the XMLTYPE returned by XMLTable as a full document, instead of a node?