1

How can I call the function fn: trace inside an xquery and that the message of the call comes out in the console of the web logic. The following example shows how to attempt to use fn: trace but Jdeveloper generates me in error.

Example of Xquery

xquery version "1.0" encoding "utf-8";

(:: OracleAnnotationVersion "1.0" ::)

declare namespace ns2="http://www.example.org/ConsultarDatosCambioPlan/";
(:: import schema at "../xsd/PS_SOA_OSB_PLF_CONSULTARDATOSCAMBIOPLAN.xsd" ::)
declare namespace ns1="http://xmlns.oracle.com/pcbpel/adapter/db/top/dbAllOperations";
(:: import schema at "../xsd/dbAllOperations_table.xsd" ::)

declare variable $RegistrosBaseDatos as element() (:: schema-element(ns1:DatosCollection) ::) external;
declare variable $Codigo as xs:string external;
declare variable $Mensaje as xs:string external;
declare variable $Descripcion as xs:string external;



declare function local:func($RegistrosBaseDatos as element() (:: schema-element(ns1:DatosCollection) ::), 
                            $Codigo as xs:string,
                            $Mensaje as xs:string,
                            $Descripcion as xs:string) 
                            as element() (:: schema-element(ns2:ConsultarDatosClienteResponse) ::){

    fn:trace($RegistrosBaseDatos)

    <ns2:ConsultarDatosClienteResponse><!-- The error appears here, Syntax error. ">" is unexpected -->
        {
            for $Datos in $RegistrosBaseDatos/ns1:Datos
            return 
            <Datos>
                <idCliente>{fn:trace($RegistrosBaseDatos,"este es el valor de ")} {fn:data(xs:int($Datos/ns1:dtsCedula))}</idCliente>
                <nomCliente>{fn:data($Datos/ns1:dtsNombre)}</nomCliente>
                <apeCliente> </apeCliente>
                <direccion>{fn:data($Datos/ns1:dtsDireccion)}</direccion>
                <telefono>{fn:data($Datos/ns1:dtsCelular)}</telefono></Datos>
        }
        <Mensaje>
            <Codigo>"codigo stas" + {fn:data($Codigo)}</Codigo>
            <Mensaje>{fn:data(fn:string($Mensaje))} + "esto no es uin buen mxl" +  {fn:data(($RegistrosBaseDatos))}</Mensaje>
            <Descripcion>{fn:data($Descripcion)}</Descripcion>
        </Mensaje>
    </ns2:ConsultarDatosClienteResponse>
};

declare function local:test($RegistrosBaseDatos as element() (:: schema-element(ns1:DatosCollection) ::)) as empty-sequence(){
  fn:trace($RegistrosBaseDatos,"este es el valor de ")
};

local:func($RegistrosBaseDatos, $Codigo,$Mensaje,$Descripcion)

1 Answers1

0

fn:trace takes two parameters, but the first call only has one:

fn:trace($RegistrosBaseDatos)
Ghislain Fourny
  • 6,971
  • 1
  • 30
  • 37