Skip to Main Content

SQL & PL/SQL

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Extract Value from XML in Pl-Sql

T JJan 18 2018 — edited Jan 18 2018

Hi I'm making an anonymous block to test extract function on my XML.

This is I,m using

DECLARE

       i_xpayload                   CLOB;

       l_result_success             VARCHAR2(50);

      

   BEGIN

   DBMS_OUTPUT.PUT_LINE ('hi');

   i_xpayload := XMLTYPE('<Confirmation revision="001">

    <App>

        <Sender>

            <Component>A</Component>

            <Confirm>Never</Confirm>

        </Sender>

        <CreationDateTime>2017-06-13</CreationDateTime>

    </App>

</Confirmation>').getclobval();

    l_result_success := i_xpayload.EXTRACT ('/Confirmation/App/Sender/Confirm//text()').getstringval ();

    DBMS_OUTPUT.PUT_LINE ('l_result_success ' || l_result_success);

END;

The procedure is completed successfully when I'm not using

    l_result_success := i_xpayload.EXTRACT ('/Confirmation/App/Sender/Confirm//text()').getstringval ();

    DBMS_OUTPUT.PUT_LINE ('l_result_success ' || l_result_success);

But when I do it is giving me error

ORA-06550: line 19, column 36:

PLS-00487: Invalid reference to variable 'I_XPAYLOAD'

ORA-06550: line 19, column 5:

PL/SQL: Statement ignored

Can someone tell me please what I'am doing wrong.

TIA

This post has been answered by BluShadow on Jan 18 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2018
Added on Jan 18 2018
7 comments
5,061 views