Skip to Main Content

DevOps, CI/CD and Automation

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!

multiple lines with same xml tags

m.ogunDec 6 2019 — edited Dec 10 2019

Hi

<?xml version='1.0' encoding='UTF-8'?>

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">

<S:Body><ns2:xyzResponse xmlns:ns2="http://xyz.xyz">

<return>

    <resCode>0</resCode>

    <resDef>SUCCESS</resDef>

    <RecordResult>

        <no>1</no>

        <resCode>0</resCode>

        <resDef>SUCCESS</resDef>

        <refNo>191206011906</refNo>

        <no>2</no>

        <resCode>-1</resCode>

        <resDef>FAILURE</resDef>

        <refNo>191206011907</refNo>

    </RecordResult>

</return>

</ns2:xyzResponse>

</S:Body>

</S:Envelope>

I have above XML and I 've been desperately trying to have it in columns.

Not sure if I can create something like LOOP for xml paths.. But I want two different output:

1-Server Response

resCoderesDef
0

SUCCESS

and

2-Process Result

noresCoderesDefrefNo
00SUCCESS191206011906
1-1FAILURE191206011907

xmltable('//return'

        passing xmltype(x.service_response)

        columns

            rescode varchar2(5) path '//resCode',

            resDef varchar2(2000) path '//resDef'

won't work. however, if I use resCode[1] it works. But only for the one line..

I think it 's not possible to bind a variable to this node (or elements?) in plsql. I 've also tried to pass variables but couldn't achived any thing useful yet.

Could you help me creating these queries?

Thank you very much in advance

This post has been answered by mNem on Dec 6 2019
Jump to Answer
Comments
Post Details
Added on Dec 6 2019
4 comments
1,065 views