Skip to Main Content

Database Software

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!

when to use xmlquery over xmlelement/xmlattributes/xmlagg

mNemJun 27 2018 — edited Jun 27 2018

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.

This post has been answered by odie_63 on Jun 27 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 25 2018
Added on Jun 27 2018
2 comments
452 views