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!

Ora-19279 when extracting data from xml

M Prasad-OracleSep 27 2018 — edited Sep 28 2018

I wanted to retrieve data with space or comma seperated from xml with same tag value e.g. Name = 'access'.Please let me know if there is any function to handle it.

I am getting below error when I try to retrieve data from xml.

SQL:

SELECT  case ip_addresses  when  'all' then 'all'

when 'disabled' then 'disabled'

Else

'IP'

END "ssh"

FROM (

            SELECT x.* FROM  ip_Details  t,

  XMLTABLE ( '/methodResponse/params/param/value'   

                      PASSING a   

      COLUMNS

      ip_addresses          VARCHAR2(40) PATH 'struct/member[name="access"]/value/array/data/value/string'

      ) x

      )

    ;

Output:

IP Address

----------------------------------

10.244.202.22 10.244.202.23

XML:

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

<methodResponse>

    <params>

        <param>

            <value>

                <struct>

                    <member>

                        <name>access</name>

                        <value>

                            <array>

                                <data>

                                    <value>

                                        <string>10.244.202.22</string>

                                    </value>

                                    <value>

                                        <string>10.244.202.23</string>

                                    </value>

                                </data>

                            </array>

                        </value>

                    </member>

                </struct>

            </value>

        </param>

    </params>

</methodResponse>

Error:

ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence

19279. 00000 -  "XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence"

*Cause:    The XQuery sequence passed in had more than one item.

*Action:   Correct the XQuery expression to return a single item sequence.

This post has been answered by mNem on Sep 27 2018
Jump to Answer

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 26 2018
Added on Sep 27 2018
7 comments
3,077 views