This is a question related to a post from @"user520824" couple of days back -
XML output from sql query
Managed to come up with the following query as a solution to the above post. What I like to know is whether this could be used as an alternative solution?
select
xmlquery
(
'
<Root>
<GlobalOptions EmailCompletionMessageTo="aabatbbb.com" ImportOption="Merge" />
<Addresses />
<Loans>
{
for $row in /ROWSET/ROW
return
<Loan LoanStatusDate = "{$row/LOANSTATUSDATE}"
LoanStatus = "{$row/LOANSTATUS}"
Application_ID = "{$row/APPLICATION_ID}">
<LoanCustomData App_Status_code = "{$row/APP_STATUS_CODE}"
App_Status_Date = "{$row/APP_STATUS_DATE}"
Product_Code = "{$row/PRODUCT_CODE}"
/>
<Borrower LastName="{$row/LASTNAME}"/>
</Loan>
}
</Loans>
</Root>
'
passing xmltype(cursor(select * from xml_table))
returning content
)
as output
from dual;
This is a learning exercise.
Thanks.