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!

dbms_xmlgen.newcontext query from multiple tables and ||

user583094Mar 2 2011 — edited Mar 4 2011
I have two questions
How do I get a dbms_xmlgen.context to query from multiple tables? I have been able to make it work with using one table only, but not with multiple tables.
And how to get the || (concat) to work within my query for my output to an xml file?

Here is my current query:

create or replace function get_xml return clob is
result clob;
qryctx dbms_xmlgen.ctxHandle;
SELECT DBMS_XMLGEN.getxml('select prefix, suffix, fiscal_yr
FROM rcv.recv_accessions ra
where ra.prefix = 8 and ra.fiscal_yr = 11')xml into result FROM dual;

result := DBMS_XMLGEN.getXML(qryCtx);

This is what I desire:

...
SELECT DBMS_XMLGEN.getxml('select ra.prefix||'-'|| ra.suffix||'-'|| ra.fiscal_yr accession, ss.date_in, st.test
FROM rcv.recv_accessions ra, ser.sero_samples ss, ser.sero_tests st
where ra.prefix = 8 and ra.fiscal_yr = 11 and ss.raid = ra.id and st.ssid = ss.id')xml into result FROM dual;
...
On this both the reference to multiple tables and the concat function cause errors.

Thank you

Edited by: user583094 on Mar 2, 2011 3:36 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 1 2011
Added on Mar 2 2011
5 comments
720 views