Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

INSERT INTO ... SELECT FROM XMLTABLE()

KnightOfBlueArmorJul 27 2013 — edited Jul 28 2013

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?

This post has been answered by odie_63 on Jul 27 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 25 2013
Added on Jul 27 2013
4 comments
2,516 views