Hi All,
I am getting the NULL SELF argument error message when I run the following package. Please advise.
Requirement: I have to read the input XML data received to the package or proc and do few checks and followed by inserts.
Issue: It is failing at first step, which is : reading the XML DATA from the procedure.
-- Package Starts
CREATE OR REPLACE PACKAGE SERVICE_MONITOR_PKG AS
PROCEDURE SERVICE_MONITOR_PROC(XML_DATA IN XMLTYPE);
END SERVICE_MONITOR_PKG;;
/
CREATE OR REPLACE PACKAGE BODY SERVICE_MONITOR_PKG AS
PROCEDURE SERVICE_MONITOR_PROC(XML_DATA IN XMLTYPE) IS
IN_APP_ID VARCHAR2(1000);
BEGIN
IN_APP_ID := XML_DATA.EXTRACT('/serviceMonitorRequest/application/version/text()').getStringVal;
DBMS_OUTPUT.PUT_LINE('IN_APP_ID = '||IN_APP_ID);
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error Code and Message = '||SQLERRM);
END;
END SERVICE_MONITOR_PKG;;
/
-- Package END
--This is how I am running the Package from Oracle SQL Developer.
DECLARE
XML_DATA XMLTYPE;
BEGIN
XML_DATA := xmltype('<serviceMonitorRequest xmlns="http://*****/schema/service-monitor/v1">
<requestHeader xmlns="http://*****/schema/common/v2">
<actionRequested AR="INSERT">
<transactionName>Trans</transactionName>
</actionRequested>
<accounting>
<transactionId>2359102</transactionId>
<requestorCode>Code</requestorCode>
<transactionDomain>NOTIFICATION</transactionDomain>
<timeStamp>2017-07-03T13:53:33.888-04:00</timeStamp>
</accounting>
</requestHeader>
<application>
<name>AppName</name>
<version>1.0</version>
<description>NoErrors</description>
<type>SERVICE</type>
<owner>TEAM</owner>
</application>
<statistics>
<statistic>
<activity>END</activity>
<biz-txn-id>15d09421165003ac039d0</biz-txn-id>
<txn-id>59102</txn-id>
<entity-id>22442</entity-id>
<consumer>DEFAULT</consumer>
<description>NoErrors</description>
<result>SUCCESS</result>
<error-msg/>
<elapsed-time>0</elapsed-time>
<node>NODE1</node>
<component>ComponentActivity</component>
<target>ResponseTarget</target>
<url>NA</url>
<request/>
<req-len>0</req-len>
<timestamp>2017-07-03T13:53:33.890-04:00</timestamp>
<success_count>1</success_count>
<failure_count>0</failure_count>
</statistic>
</statistics>
</serviceMonitorRequest>');
SERVICE_MONITOR_PKG.SERVICE_MONITOR_PROC(
XML_DATA => XML_DATA
);
END;
Thanks in Advance!!
Please let me know if you need more information.