2 Replies Latest reply: Jul 8, 2013 5:33 AM by mustafa_yilmaz RSS

    Call Function from PLSQL--ORA-31013 : Invalid XPATH expressioon

    mustafa_yilmaz

      I tried the following SQL statement. when I called function,it giving error.


      select *

      from v$version;

      ----

      1Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
      2PL/SQL Release 10.2.0.3.0 - Production
      3CORE              10.2.0.3.0Production
      4TNS for Linux: Version 10.2.0.3.0 - Production
      5NLSRTL Version 10.2.0.3.0 - Production



       

      function READ_SYSTEM_RESPONSE(PARAM IN CLOB)

        RETURN NUMBER

        AS

          l_namespace varchar2(1000):='xsi:schemaLocation="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader PackageProxy.xsd"

                                      xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader"

                                      xmlns:ef="http://www.efatura.gov.tr/package-namespace"

                                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"';

          x  XMLTYPE

            := XMLTYPE('<?xml version="1.0" encoding="UTF-8"?>

                          <sh:StandardBusinessDocument xsi:schemaLocation="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader PackageProxy.xsd"

                            xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader"

                            xmlns:ef="http://www.efatura.gov.tr/package-namespace"

                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

                      <sh:StandardBusinessDocumentHeader>

                      <sh:HeaderVersion>1.0</sh:HeaderVersion>

                      </sh:StandardBusinessDocumentHeader>

                      </sh:StandardBusinessDocument>');

          CURSOR ana IS

                SELECT 1--EXTRACTVALUE(VALUE (p),'/sh:StandardBusinessDocumentHeader/sh:HeaderVersion',l_namespace) AS IMZA

                FROM TABLE(XMLSEQUENCE (EXTRACT (x,'/sh:StandardBusinessDocument',l_namespace))) p;

          BEGIN

          FOR r IN ana

          loop

          dbms_output.put_line('- - - - - - -');

          end loop;

          RETURN 1;

          EXCEPTION WHEN OTHERS THEN

          dbms_output.put_line(sqlerrm);

            RETURN 0;

          END;