XMLAgg and order by
363037Feb 19 2003 — edited Feb 20 2003Hello -
I am having trouble with XMLAgg and order by in nested elements. I saw that there was a patch, but I'm wondering if there are any examples of the syntax. Here is what my SQLX looks like and I want to order the citations in the citation list (which is the last of the nested XMLAgg's) by pub_type_sort_num:
SELECT
XMLELEMENT("CASE",
XMLFOREST(c.uuid,c.serial_number, c.filed_date,c.long_title),
XMLELEMENT("COURT_NAME",XMLATTRIBUTES(cl.courtline_code as "court_code"), cl.court_display_name),
XMLELEMENT("COURT_AGENCY_CODE",cl.court_agency_code),
XMLELEMENT("JURISDICTION_CODE",cl.jurisdiction_code),
/* start docket number list */
(SELECT
(XMLAGG
(XMLELEMENT("DOCKET_NUMBER",
XMLATTRIBUTES(d.docket_alternate_flag as "alternate_flag",
d.core_docket_number_flag as "core_docket",
d.search_docket_number_flag as "search_docket"),d.docket_number)))
FROM
docket_number d
WHERE
d.uuid = c.uuid ) as "DOCKET_LIST",
/* start nlp search value list */
(SELECT (XMLAGG(XMLELEMENT("NLP_SEARCH_VALUE", ctp.nlp_search_value)))
FROM case_title_part ctp
WHERE ctp.uuid = c.uuid ) as "NLP_LIST",
/* start citation list */
(SELECT (XMLAGG(XMLELEMENT("CITATION",XMLELEMENT("PUBLICATION",XMLATTRIBUTES(pl.publication_code as "code"), pl.pub_display_name),
XMLFOREST(ci.citation_volume, ci.citation_page, ptl.pub_type_sort_num))))
FROM
citation ci,
publication_lookup
pl, publication_type_lookup ptl
WHERE ci.uuid = c.uuid
and
ci.publication_code = pl.publication_code
and pl.pub_type_code = ptl.pub_type_code
) as "CITATION_LIST").getStringVal()
FROM case c, case_courtline cc, courtline_lookup cl
where c.uuid in( 'I00001940f24511d68a999ea0c29840cc', 'I00001a50f17611d6b9cee63870c71594',
'I00002500f26011d68a999ea0c29840cc', 'I00002870f1c511d697c7c010e6d2455e')
and cc.uuid = c.uuid and cc.courtline_code = cl.courtline_code
Any help is greatly appreciated.
Tom