Skip to Main Content

SQL & PL/SQL

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!

XML document must have a top level element. Error

dprogrammerxNov 2 2010 — edited Nov 3 2010
Hi, I am trying to generate an XML. Below is a sample code from my function. The function generates a 0 byte file which when I try to open gives me 'xml document must have a top level element' error. Any ideas?
FUNCTION generateXml(    p_1      VARCHAR2,
                         p_2      VARCHAR2,
                         p_3      VARCHAR2
                         ) RETURN CLOB
IS
    ctx dbms_xmlgen.ctxHandle;
    xml CLOB;
    v_sql varchar2(2000);

BEGIN


lv_sql:=' select * from v_dc where rownum =1';

ctx := dbms_xmlgen.newContext(v_sql);
dbms_xmlgen.setRowSetTag(ctx, 'CONTENT');
xml := dbms_xmlgen.getXML(ctx);
return xml;
END;
END generateXml;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 1 2010
Added on Nov 2 2010
5 comments
769 views