5

I am attempting to run SQL on a table (called test_xml with a column xml_data [data type xmltype]). The column contains xml with repeating nodes (test_3). The following statement runs successfully when the node contains data of a non clob size:

SELECT 
   extractvalue (Value (wl), '*/test_3')
      FROM test_xml
         , TABLE (xmlsequence (extract (xml_data, '*/record'))) wl

but fails when test_3 node contains a lot of data:

ORA-01706: user function result value was too large

I amended my query:

SELECT 
   extractvalue(Value (wl), '*/test_3').getClobVal()
      FROM test_xml
         , TABLE (xmlsequence (extract (xml_data, '*/record'))) wl

but this fails with:

ORA-22806: not an object or REF

1 Answer 1

9

This was resolved via a response received on Oracle Forums:

See Forum Post

From Oracle release 11.2.0.2:

SELECT x.*
FROM test_xml t
   , XMLTable(
       '/*/record'
       passing t.xml_data
       columns
         test_3  clob path 'test_3'
     ) x
;

My database version is 10.2.0.4 hence the following 'trick' is required:

SELECT dbms_xmlgen.convert(x.test_3.getClobVal(), 1) as test_3
FROM test_xml t
   , XMLTable(
       '/*/record'
       passing t.xml_data
       columns
         test_3  xmltype path 'test_3/text()'
     ) x
;

Thanks go to odie_63 for this

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.