Parse BPEL output using PL/SQL

Hello,
I am invoking WSDL from PL/SQL and WSDL is returning following output.
+<?xml version="1.0" encoding="UTF-8"?>+
+<SOAP-ENV:Envelope+
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<SOAP-ENV:Header+
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"></SOAP-ENV:Header><SO
AP-ENV:Body>
+<ser-root:soapIntefraceASVOutput+
xmlns:ser-root="http://eai.corpit.microsoft.com/microAccountValidation/provider/Acc
ountStringValidator"><acctStringValidateOutput>
+<status>112</status>+
+<message>In+
valid account segment
code</message></acctStringValidateOutput></ser-root:soapIntefraceASVOutput></SOA
P-ENV:Body>
+</SOAP-ENV:Envelope>+
I wanted to parse this XML in my PL/SQL Block and wanted to retrieve <status> and <message> element Value.
Please help me on this.
Thank You
AB,

This is probably not a good pattern for invoking webservices from database, it would be better to invoke this webserivce asynchronously via a queue/table and have another webservice invoked from that webservice, which would process the response, wrapping the pl/sql logic - but then your case may be unique.
To parse this XML in pl/sql, you would do the following if the varchar2 variable v_response_string contains the soap response from the web service:
v_response := XMLType.createXML(v_response_string);
v_status := v_response.extract('/soap:Envelop/soap:Body/ser-root:soapIntefraceASVOutput/acctStringValidateOutput/status/text()'
, 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" '||
'xmlns:ser-root="http://eai.corpit.microsoft.com/microAccountValidation/provider/AccountStringValidator"'
v_ message := v_response.extract('/soap:Envelop/soap:Body/ser-root:soapIntefraceASVOutput/acctStringValidateOutput/message/text()'
, 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" '||
'xmlns:ser-root="http://eai.corpit.microsoft.com/microAccountValidation/provider/AccountStringValidator"'
Hope this helps,
Thanks,
Shanmu.
http://www.prshanmu.com/articles/

Similar Messages

  • Parse BPEL Output in PL-SQL

    Hello,
    I am invoking WSDL from PL/SQL and WSDL is returning following output.
    +<?xml version="1.0" encoding="UTF-8"?>+
    +<SOAP-ENV:Envelope+
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    +<SOAP-ENV:Header+
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"></SOAP-ENV:Header><SO
    AP-ENV:Body>
    +<ser-root:soapIntefraceASVOutput+
    xmlns:ser-root="http://eai.corpit.microsoft.com/microAccountValidation/provider/Acc
    ountStringValidator"><acctStringValidateOutput>
    +<status>112</status>+
    +<message>In+
    valid account segment
    code</message></acctStringValidateOutput></ser-root:soapIntefraceASVOutput></SOA
    P-ENV:Body>
    +</SOAP-ENV:Envelope>+
    I wanted to parse this XML in my PL/SQL Block and wanted to retrieve <status> and <message> element Value.
    Please help me on this.
    Thank You
    AB,

    using XPATH and a SQL you can get it.
    eg:
    -- test with 10gR2
    CURSOR grab_one_value(xt IN xmltype, path_to IN VARCHAR2) IS
    SELECT extractvalue(xt, path_to, c_namespace)
    FROM dual;
    OPEN grab_one_value(xml_in, tag_in);
    FETCH grab_one_value
    INTO v_out;
    CLOSE grab_one_value;
    RETURN v_out;
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • READ CONCURRENT OUTPUT USING PL/SQL

    Hi,
    Environment - multi node.
    Is there any possibility for reading concurrent request output from db node using pl/sql coding.
    Rgds,
    Sathya

    STEP - 2
    SQL>
    SQL> DECLARE
      2    l_ctx dbms_xmlsave.ctxType ;
      3    l_xml CLOB :=
      4  '<?xml version="1.0" encoding="UTF-8" ?>
      5  <NewDataSet>
      6      <ROW>
      7          <DEPARTMENT>BA52</DEPARTMENT>
      8          <PCS_CONTRACT_TAG>MD-3GSM</PCS_CONTRACT_TAG>
      9          <LOCATION>Australia</LOCATION>
    10          <MAY_2006>21668</MAY_2006>
    11      </ROW>
    12      <ROW>
    13          <DEPARTMENT>BA501</DEPARTMENT>
    14          <PCS_CONTRACT_TAG>MD-3GSM</PCS_CONTRACT_TAG>
    15          <LOCATION>China</LOCATION>
    16          <MAY_2006>8166</MAY_2006>
    17      </ROW>
    18      <ROW>
    19          <DEPARTMENT>BA522</DEPARTMENT>
    20          <PCS_CONTRACT_TAG>MD-3GSM</PCS_CONTRACT_TAG>
    21          <LOCATION>Australia</LOCATION>
    22          <MAY_2006>21668</MAY_2006>
    23      </ROW>
    24  </NewDataSet>' ;
    25  BEGIN
    26      l_ctx := dbms_xmlsave.newContext(targetTable => 'XML_INSERT');
    27      dbms_output.put_line(dbms_xmlsave.insertXML(ctxHdl => l_ctx,
    28                                                  xDoc   => l_xml) ||
    29                           ' rows inserted.');
    30      dbms_xmlsave.closeContext(l_ctx);
    31  END;
    32  /
    3 rows inserted.
    PL/SQL procedure successfully completed.Regards.
    Satyaki De.

  • Parse JSON records using PL/SQL and store the output in Oracle Database.

    We have JSON data/record stored in a Oracle table as CLOB(database version 10g). We need to read/parse this JSON data and recognize the relevant tags and corresponding values in this JSON data and then insert these id/values into a separate Oracle staging table.
    Please let me know if there is any re-usable code available for this.
    We are looking for solution that does this manipulation in pl/sql. If this is not feasible, even Java code approach is fine.
    Regards,
    Kiranmayi.

    Hello,
    PL/JSON | Free software downloads at SourceForge.net
    ERASME - pl/sql library for JSON
    Regards
    Marcus

  • Parse an Aggregate in XML Document using PL/SQL

    Hi. I've been successful with parsing a TAG in XML Document stored in CLOB using PL/SQL XML Parser.
    However, I need help on how to get the whole aggregate in XML Document stored in CLOB.
    sample XML Doc :
    <library>
    <book>
    <title>Oracle Complete Reference</title>
    <author>Kevin</Author>
    <year>2000</year>
    </book>
    <video>
    <title>Learning C++</title>
    <length>2 hours</length>
    <video>
    </library>
    I need a function that will accept an Input which is the aggregate name and will return the aggregate value.
    With the sample XML above, say the input is 'VIDEO', the function will return :
    <video>
    <title>Learning C++</title>
    <length>2 hours</length>
    <video>
    I'll really appreciate any help.
    null

    I used such an example to parse several Varchar2 strings in a given DB session:
    BEGIN
    parser := xmlparser.newparser ;
    xmlparser.parsebuffer(parser,xmlout) ;
    domdoc := xmlparser.getDocument(parser) ;
    xmlparser.FREEPARSER(parser) ;
    parser.id := -1 ;
    nodes := xslprocessor.selectNodes(
    xmldom.makenode(domdoc),
    'Positionen/Position') ;
    for i in 1 .. xmldom.getLength(nodes) loop
    node := xmldom.item(nodes,i-1) ;
    -- do s/thing with the node
    end loop ;
    xmldom.freedocument(domdoc) ;
    RETURN(komponenten) ;
    EXCEPTION
    WHEN OTHERS THEN
    if parser.id <> -1 then xmlparser.freeparser(parser) ;
    end if ;
    if domdoc.id <> -1 then xmldom.freedocument(domdoc) ;
    end if ;
    RAISE ;
    END ;
    However, after about 2000 of nodes lists parsed, I get an ArrayIndexOutOfBoundsException from XMLNodeCover. Obviously, I should release the nodes or the nodelist, but I have not found any procedure to do this.
    Pascal

  • BPEL process to Insert XML into DB using pl/sql stored proc

    Hi,
    We have created a BPEL process in which we are taking input request and store it into Oracle Database using PL/SQL proc.
    We have been unsuccessful in doing so because the data stored in table has root element missing.
    Has any body done this (insert xml into DB using pl/sql stored proc) successfully ?
    We can so this successfully if we do not use stored procedure and store data directly in table.
    Regards

    I have done this, stored it as a CLOB.
    Also I received the payload as an opaque schema, so I had to convert the message from binary into string.
    This way the root element doesn't get removed.
    cheers
    James

  • Unable to update BPEL workflow task using pl/sql procedure

    All,
    I am on a project which involves APEX/BPEL integration. There is a need to update a workflow task created using pl/sql block of code.
    This uses the out of the box TaskQueryService webservice calls and I am getting the below exception.
    7,380> <ERROR> <default> <::>
    <2009-11-02 04:21:37,380> <ERROR> <default> <::> Cipher decryption error.
    <2009-11-02 04:21:37,380> <ERROR> <default> <::> Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::>
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at com.collaxa.cube.util.DESService.decrypt(DESService.java:74)
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at oracle.bpel.services.workflow.verification.impl.VerificationService.decryptString(VerificationService.java:2112)
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> ... 33 more
    <2009-11-02 04:21:37,381> <ERROR> <oracle.bpel.services.workflow> <::> Cipher decryption error.
    Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
    ORABPEL-00007
    As an alternative I tried to call the procedure from a Java client and it throws the same exceptions (the workflow context is gotten from the Java API call
    workflowContext = taskQueryService.authenticate(WF_MANANAGER_UN, WF_MANANAGER_PW, null, worklistUser);),
    however updating the Task from Java using the ora.bpel library API's works perfectly fine.
    But the client's requirement is to update taskoutcome from pl/sql.
    Please find the exceptions and the code below............. your help is much appreciated.
    Procedure Code and details exceptions below...........:
    REATE OR REPLACE PROCEDURE PR_UPDATE_TASK_FLOW (P_CONTEXT VARCHAR2, P_TASK_ID VARCHAR2)
    AS
    soap_respond VARCHAR2(30000);
    http_req UTL_HTTP.REQ;
    http_resp UTL_HTTP.RESP;
    launch_url VARCHAR2(240);
    l_task_id varchar2(200) := '01647e0505013d7c:25e029b2:124ae1076ef:-7d29';
    l_context varchar2(2000) := '9xReYA5T2NJegzDAVBQl8qNFjFxETMKVK6Y7L5Tz+ZmEG/Mu3BIfABrZG4UeLDlSqqFy/nvYWsjhPoDR+qdgoMBgfEhokt93rPOA/tChlGcI2lOCp5ww0FqKdjii99QFjOjO3c9Vqwghax2h+IvK0hWshBja0lecuc05epm6gpiHt3FFKILOMXbmZ6nR3P+eRAhWsTR7B6FBnw3Xr5QOHQ==';
    l_endpoint_url VARCHAR2(200);
    l_bpel_action VARCHAR2(100);
    l_soap_envelop VARCHAR2(2000) := '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body xmlns:ns1="http://xmlns.oracle.com/bpel/workflow/taskService">
    <updateOutcomeOfTasks xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">
    <workflowContext xmlns="http://xmlns.oracle.com/bpel/workflow/common">
    <token xmlns="http://xmlns.oracle.com/bpel/workflow/common">P_CONTEXT</token>
    </workflowContext>
    <taskId xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">P_TASK_ID</taskId>
    <outcome xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">COMPLETE</outcome>
    </updateOutcomeOfTasks>
    </soap:Body>
    </soap:Envelope>';
    BEGIN
    HTTP_REQ:= UTL_HTTP.BEGIN_REQUEST
    TRIM('http://soaapn1.mrc.co.la.ca.us:7777/integration/services/TaskService/TaskServicePort')
    ,'POST'
    ,'HTTP/1.1'
    UTL_HTTP.SET_HEADER(http_req, 'Content-Type', 'text/xml') ;
    UTL_HTTP.SET_HEADER(http_req, 'Content-Length', LENGTH(l_soap_envelop)) ;
    UTL_HTTP.SET_HEADER(http_req, 'SOAPAction', 'updateOutcomeOfTasks');
    UTL_HTTP.WRITE_TEXT(http_req, l_soap_envelop) ;
    http_resp:= UTL_HTTP.GET_RESPONSE(http_req) ;
    UTL_HTTP.READ_TEXT(http_resp, soap_respond) ;
    UTL_HTTP.END_RESPONSE(http_resp) ;
    EXCEPTION WHEN OTHERS THEN
    dbms_output.put_line(sqlerrm);
    END PR_UPDATE_TASK_FLOW;
    EXCEPTION MESSAGE:
    <2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> ORABPEL-30504
    <2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::>
    <2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Internal Error in Verification Service.
    <2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Internal Error in Verification Service for user {0}. {1}
    <2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Check the underlying exception and correct the error. Contact oracle support if error is not fixable.
    7,380> <ERROR> <default.collaxa.cube.services> <::>
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> Cipher decryption error.
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::>
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at com.collaxa.cube.util.DESService.decrypt(DESService.java:74)
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at oracle.bpel.services.workflow.verification.impl.VerificationService.decryptString(VerificationService.java:2112)
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> ... 33 more
    <2009-11-02 04:21:37,381> <ERROR> <oracle.bpel.services.workflow> <::> Cipher decryption error.
    Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
    ORABPEL-00007

    All,
    I am on a project which involves APEX/BPEL integration. There is a need to update a workflow task created using pl/sql block of code.
    This uses the out of the box TaskQueryService webservice calls and I am getting the below exception.
    7,380> <ERROR> <default> <::>
    <2009-11-02 04:21:37,380> <ERROR> <default> <::> Cipher decryption error.
    <2009-11-02 04:21:37,380> <ERROR> <default> <::> Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::>
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at com.collaxa.cube.util.DESService.decrypt(DESService.java:74)
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at oracle.bpel.services.workflow.verification.impl.VerificationService.decryptString(VerificationService.java:2112)
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> ... 33 more
    <2009-11-02 04:21:37,381> <ERROR> <oracle.bpel.services.workflow> <::> Cipher decryption error.
    Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
    ORABPEL-00007
    As an alternative I tried to call the procedure from a Java client and it throws the same exceptions (the workflow context is gotten from the Java API call
    workflowContext = taskQueryService.authenticate(WF_MANANAGER_UN, WF_MANANAGER_PW, null, worklistUser);),
    however updating the Task from Java using the ora.bpel library API's works perfectly fine.
    But the client's requirement is to update taskoutcome from pl/sql.
    Please find the exceptions and the code below............. your help is much appreciated.
    Procedure Code and details exceptions below...........:
    REATE OR REPLACE PROCEDURE PR_UPDATE_TASK_FLOW (P_CONTEXT VARCHAR2, P_TASK_ID VARCHAR2)
    AS
    soap_respond VARCHAR2(30000);
    http_req UTL_HTTP.REQ;
    http_resp UTL_HTTP.RESP;
    launch_url VARCHAR2(240);
    l_task_id varchar2(200) := '01647e0505013d7c:25e029b2:124ae1076ef:-7d29';
    l_context varchar2(2000) := '9xReYA5T2NJegzDAVBQl8qNFjFxETMKVK6Y7L5Tz+ZmEG/Mu3BIfABrZG4UeLDlSqqFy/nvYWsjhPoDR+qdgoMBgfEhokt93rPOA/tChlGcI2lOCp5ww0FqKdjii99QFjOjO3c9Vqwghax2h+IvK0hWshBja0lecuc05epm6gpiHt3FFKILOMXbmZ6nR3P+eRAhWsTR7B6FBnw3Xr5QOHQ==';
    l_endpoint_url VARCHAR2(200);
    l_bpel_action VARCHAR2(100);
    l_soap_envelop VARCHAR2(2000) := '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body xmlns:ns1="http://xmlns.oracle.com/bpel/workflow/taskService">
    <updateOutcomeOfTasks xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">
    <workflowContext xmlns="http://xmlns.oracle.com/bpel/workflow/common">
    <token xmlns="http://xmlns.oracle.com/bpel/workflow/common">P_CONTEXT</token>
    </workflowContext>
    <taskId xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">P_TASK_ID</taskId>
    <outcome xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">COMPLETE</outcome>
    </updateOutcomeOfTasks>
    </soap:Body>
    </soap:Envelope>';
    BEGIN
    HTTP_REQ:= UTL_HTTP.BEGIN_REQUEST
    TRIM('http://soaapn1.mrc.co.la.ca.us:7777/integration/services/TaskService/TaskServicePort')
    ,'POST'
    ,'HTTP/1.1'
    UTL_HTTP.SET_HEADER(http_req, 'Content-Type', 'text/xml') ;
    UTL_HTTP.SET_HEADER(http_req, 'Content-Length', LENGTH(l_soap_envelop)) ;
    UTL_HTTP.SET_HEADER(http_req, 'SOAPAction', 'updateOutcomeOfTasks');
    UTL_HTTP.WRITE_TEXT(http_req, l_soap_envelop) ;
    http_resp:= UTL_HTTP.GET_RESPONSE(http_req) ;
    UTL_HTTP.READ_TEXT(http_resp, soap_respond) ;
    UTL_HTTP.END_RESPONSE(http_resp) ;
    EXCEPTION WHEN OTHERS THEN
    dbms_output.put_line(sqlerrm);
    END PR_UPDATE_TASK_FLOW;
    EXCEPTION MESSAGE:
    <2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> ORABPEL-30504
    <2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::>
    <2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Internal Error in Verification Service.
    <2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Internal Error in Verification Service for user {0}. {1}
    <2009-11-02 04:21:37,379> <ERROR> <default.collaxa.cube.services> <::> Check the underlying exception and correct the error. Contact oracle support if error is not fixable.
    7,380> <ERROR> <default.collaxa.cube.services> <::>
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> Cipher decryption error.
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::>
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at com.collaxa.cube.util.DESService.decrypt(DESService.java:74)
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> at oracle.bpel.services.workflow.verification.impl.VerificationService.decryptString(VerificationService.java:2112)
    <2009-11-02 04:21:37,380> <ERROR> <default.collaxa.cube.services> <::> ... 33 more
    <2009-11-02 04:21:37,381> <ERROR> <oracle.bpel.services.workflow> <::> Cipher decryption error.
    Failed to decrypt cipher text with transformation "DESede/ECB/PKCS5Padding"; exception reported is Input length (with padding) not multiple of 8 bytes.
    ORABPEL-00007

  • How to get this output using sql query?

    Hi,
      How to get this output using sql query?
    Sno Name Age ADD Result
    1 Anil 23 delhi Pass
    2 Shruti 25 bangalor Pass
    3 Arun 21 delhi fail
    4 Sonu 23 pune Pass
    5 Roji 26 hydrabad fail
    6 Anil 28 delhi pass
    Output
    Sno Name Age ADD Result
    1 Anil 23 delhi pass
    28 delhi pass

    Hi Vamshi,
    Your query is not pretty clear.
    write the select query using Name = 'ANIL' in where condition and display the ouput using Control-break statements.
    Regards,
    Kannan

  • 4.1EA2 User-Defined-Report strips CRLF when using PL/SQL DBMS Output

    Hi,
    I have a report with a child report.
    That child report uses pl/sql to print to the screen. (dbms output)
    When i use the procedure manually it prints fine.
    When i copy this output to a text editor i can see the CRLF in there.
    If i call the same procedure tru the reports section of SQLDeveloper the output is stripped of any CRLF characters.
    This is causing it to be useless for me: i am using it to generate code and it all appears as one big line on the screen.
    Copying this to a text editor indeed shows all CRLFs gone.
    Is this intentional or a bug ?

    Jeff,
    Thnx for the answer.
    I don't have a problem writing html in my code being a former webdeveloper with experience in apex as well.
    The problem is that the option presents itself as a standard plsql dbmsoutput, which suggests identical output as a dbmsoutput pane in sqldeveloper.
    From your answer i gather it really is supposed to do html formatting.
    Your "solution" of inserting br tags would be fine if it weren't for the fact that when i do a copy of the output in this report pane sqldeveloper strips away the br tags but doesn't replace them with crlf's.
    And since the crlfs that were in the output are also stripped in this result pane i get a single line of text when i copy over a page of text from the result pane into a normal texteditor.
    As such it behaves differently then say a browser when i copy a page of text from the browser and paste it in a text editor. There i see the crlfs that were present in the original source.
    Is there a listing somewhere that explains what tags are supported?
    Or CSS ?
    Does it support stuff like white-space: pre ?
    I understand the usefullness of a html-aware plsql dbmsoutput output option in the reports list of a user-defined report.
    However i would like to use this opportunity to advocate to include , as an extra option or tick box etc., an option to just display the output as the normal dbmsoutput pane displays it.
    That is without extra formatting.
    I like the idea of being able to click in the table section above and to have bottom pane generate the appropriate code as output.
    That  use-case can not happen right now since it formats as html (and not even the correct way) or, when going along with this route, strips everything to a single line of text when copying the data from the result pane.
    rgrds mike

  • Extract XML output to file using PL/SQL

    Hi.
    Since Oracle 8.1.4.7.1 I am using XML output in my applications.
    With that version of Oracle, my method was:
    1. Make the select;
    2. Create a file somewhere in my C drive;
    3. Create the XML file header;
    3. For each row, insert into the file, with the correct format;
    4. Close the file;
    ... and, voilá ... the XML file was made.
    Now, with the Oracle 10g, I know that I have much more ways to do it:
    1. Package DBMS_XMLQUERY
    2. Statements like
    "SELECT XMLELEMENT("USERS", XMLELEMENT("nome_pessoa", e.nome_pessoa ||' - '|| e.login), XMLELEMENT ( "password", e.password)) AS "result"
    FROM pessoa e"
    3. Or finally using XML SQL Utility.
    My question, is that if there is any way that i can make it all of this automatically. If there is any procedure or method that allow me to do all this stuff in just one step:
    1. Select in XML output;
    2. Creation of file;
    3. Insertion of Select output in file and Close of File;
    Thankx,

    I'm assuming that you want to write to the file system of the server that the database is running on...
    you'll have to use utl_file
    See
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/appdev.920/a96612/u_file.htm

  • How is the output of TempDBAnalysis.sql run during a SQLDiag.EXE session used to troubleshoot tempdb contention?

    Hi,
    I recently came across the option in PSSDiag configuration utility to collect data using the "SQL 2005 tempdb Space and Latching" option.  I executed this on a test server and it generated the file {servername}_TempDBAnalysis_Startup.out. 
    This contains the output of a set of queries that are run in a 10s loop. 
    I have two questions regarding this output.
    1.  Are there any of the analytical tools in SQLNexus or PAL that display, summarize, or trend this data in any way? I do not see any but would like to confirm with the forum.
    2. If there are no analytical outputs, is there any summary out on the web of how to analyze this data, how to import it into a db, or how to interpret the output of each individual query?
    Thanks in advance for any assistance in this matter!

    Hi Lorrin,
    You can reference the below links.
    Tool to help you analyze SQL Server SQLDIAG and PSSDIAG output
    How to use SQLDiag, SQLNexus and PAL tools to analyze performance issues in SQL Server
    If you have any feedback on our support, please click
    here.
    Eric Zhang
    TechNet Community Support

  • Adding new element to BPEL for use in PL SQL type, has binding errors

    Figured I might as well post this here since I haven't gotten a single reply in 3 days anywhere else :/
    I have a BPEL service that calls a PL SQL procedure. I have added a new element to the BPEL called quote_cart_line.
    All I had to the BPEL to accomplish this was edit 3 files -
    Async_Invoke_Import_Model.xsd (Source)
    <element name="orig_sys_line_ref" type="integer" minOccurs="1" nillable="true"/>
           <element name="quote_cart_line" minOccurs="1" nillable="true" type="integer"/>
          </sequence>
    .....APPS_NI_MODEL_IMPORT_UTIL_IMPORT_SELECTIONS.xsd (Target)
    <element name="ORIG_SYS_LINE_REF" type="decimal" db:type="NUMBER" minOccurs="0" nillable="true"/>
             <element name="QUOTE_CART_LINE" type="decimal" db:type="NUMBER" minOccurs="0" nillable="true"/>
          </sequence>
    .....Transform_NIE_Inputs.xsl (Transforming from Source to Target)
    <ns1:orig_sys_line_ref>
              <xsl:value-of select="/ns1:Async_Invoke_Import_ModelProcessRequest/ns1:import_line/ns1:orig_sys_line_ref"/>
            </ns1:orig_sys_line_ref>
            <ns1:quote_cart_line>
              <xsl:value-of select="/ns1:Async_Invoke_Import_ModelProcessRequest/ns1:import_line/ns1:quote_cart_line"/>
            </ns1:quote_cart_line>
          </ns1:import_line>
    .....I have done this to two other BPELs and they work fine. (1st BPEL calls the second BPEL passing this new element, which then passes it to this BPEL I am having trouble with, which then should be binding it to a PL SQL type)
    So this BPEL calls a PL SQL procedure, binding the elements from the BPEL to a PL SQL type (ni_model_import_line). So I edited the PL SQL type to accept this new parameter:
    orig_sys_header_ref       NUMBER,
           quote_cart_line           NUMBER,
           CONSTRUCTOR FUNCTION ni_model_import_line(p_part_number                IN VARCHAR2,
    MEMBER PROCEDURE add_orig_sys_header_ref(p_org_sys_header_ref          IN NUMBER),
           MEMBER PROCEDURE add_quote_cart_line(p_quote_cart_line                 IN NUMBER)
    MEMBER PROCEDURE add_quote_cart_line(p_quote_cart_line                 IN NUMBER) IS
    BEGIN
       quote_cart_line := p_quote_cart_line;
    END add_quote_cart_line;
    END;
    .....I invoke all of this, and the new element gets populated in 3 different BPELs, including this one I explained here. But when it comes time to call the PL SQL I am now getting an error:
    <fault>
    -<bpelFault>
    <faultType>0</faultType>
    -<bindingFault xmlns="http://schemas.oracle.com/bpel/extension">
    -<part name="summary">
    <summary>
    Exception occured when binding was invoked.
    Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'nie_import_2' failed due to: Interaction processing error.
    Error while processing the execution of the APPS.NI_MODEL_IMPORT_UTIL.IMPORT_SELECTIONS API interaction.
    An error occurred while processing the interaction for invoking the APPS.NI_MODEL_IMPORT_UTIL.IMPORT_SELECTIONS API. Cause: java.lang.NullPointerException
    The invoked JCA adapter raised a resource exception.
    Please examine the above error message carefully to determine a resolution.
    </summary>
    </part>
    -<part name="detail">
    <detail>null</detail>
    </part>
    -<part name="code">
    <code>null</code>
    </part>
    </bindingFault>
    </bpelFault>
    </fault>This doesnt happen if I remove the references to this new element and try again, so it obviously is a problem with the element, but I have no idea what it is. It works fine when going from BPEL to BPEL, but as soon as the process tries to call the PL SQL procedure this happens. It is even more frustrating because I have done this exactly before adding another element, and it worked fine...
    Any ideas or tips please?

    Figured I might as well post this here since I haven't gotten a single reply in 3 days anywhere else :/
    I have a BPEL service that calls a PL SQL procedure. I have added a new element to the BPEL called quote_cart_line.
    All I had to the BPEL to accomplish this was edit 3 files -
    Async_Invoke_Import_Model.xsd (Source)
    <element name="orig_sys_line_ref" type="integer" minOccurs="1" nillable="true"/>
           <element name="quote_cart_line" minOccurs="1" nillable="true" type="integer"/>
          </sequence>
    .....APPS_NI_MODEL_IMPORT_UTIL_IMPORT_SELECTIONS.xsd (Target)
    <element name="ORIG_SYS_LINE_REF" type="decimal" db:type="NUMBER" minOccurs="0" nillable="true"/>
             <element name="QUOTE_CART_LINE" type="decimal" db:type="NUMBER" minOccurs="0" nillable="true"/>
          </sequence>
    .....Transform_NIE_Inputs.xsl (Transforming from Source to Target)
    <ns1:orig_sys_line_ref>
              <xsl:value-of select="/ns1:Async_Invoke_Import_ModelProcessRequest/ns1:import_line/ns1:orig_sys_line_ref"/>
            </ns1:orig_sys_line_ref>
            <ns1:quote_cart_line>
              <xsl:value-of select="/ns1:Async_Invoke_Import_ModelProcessRequest/ns1:import_line/ns1:quote_cart_line"/>
            </ns1:quote_cart_line>
          </ns1:import_line>
    .....I have done this to two other BPELs and they work fine. (1st BPEL calls the second BPEL passing this new element, which then passes it to this BPEL I am having trouble with, which then should be binding it to a PL SQL type)
    So this BPEL calls a PL SQL procedure, binding the elements from the BPEL to a PL SQL type (ni_model_import_line). So I edited the PL SQL type to accept this new parameter:
    orig_sys_header_ref       NUMBER,
           quote_cart_line           NUMBER,
           CONSTRUCTOR FUNCTION ni_model_import_line(p_part_number                IN VARCHAR2,
    MEMBER PROCEDURE add_orig_sys_header_ref(p_org_sys_header_ref          IN NUMBER),
           MEMBER PROCEDURE add_quote_cart_line(p_quote_cart_line                 IN NUMBER)
    MEMBER PROCEDURE add_quote_cart_line(p_quote_cart_line                 IN NUMBER) IS
    BEGIN
       quote_cart_line := p_quote_cart_line;
    END add_quote_cart_line;
    END;
    .....I invoke all of this, and the new element gets populated in 3 different BPELs, including this one I explained here. But when it comes time to call the PL SQL I am now getting an error:
    <fault>
    -<bpelFault>
    <faultType>0</faultType>
    -<bindingFault xmlns="http://schemas.oracle.com/bpel/extension">
    -<part name="summary">
    <summary>
    Exception occured when binding was invoked.
    Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'nie_import_2' failed due to: Interaction processing error.
    Error while processing the execution of the APPS.NI_MODEL_IMPORT_UTIL.IMPORT_SELECTIONS API interaction.
    An error occurred while processing the interaction for invoking the APPS.NI_MODEL_IMPORT_UTIL.IMPORT_SELECTIONS API. Cause: java.lang.NullPointerException
    The invoked JCA adapter raised a resource exception.
    Please examine the above error message carefully to determine a resolution.
    </summary>
    </part>
    -<part name="detail">
    <detail>null</detail>
    </part>
    -<part name="code">
    <code>null</code>
    </part>
    </bindingFault>
    </bpelFault>
    </fault>This doesnt happen if I remove the references to this new element and try again, so it obviously is a problem with the element, but I have no idea what it is. It works fine when going from BPEL to BPEL, but as soon as the process tries to call the PL SQL procedure this happens. It is even more frustrating because I have done this exactly before adding another element, and it worked fine...
    Any ideas or tips please?

  • BI publisher concurrent comes back with warning trying to use PL/SQL

    Hello,
    I am new to BI publisher and I am trying to use PL/SQL to generate XML and have the Publisher display the report with a template I have created. The concurrent is completing with a warning and from looking at the other forum posts I found the following in the OPP error logs...
    Template code:XML_TEST
    Template app: XML
    Language: en
    Territory: 00
    Output type: RTF
    [3/2/11 2:27:37 PM] [393078:RT2163613] Output file was found but is zero sized - Deleted
    [3/2/11 2:27:37 PM] [UNEXPECTED] [393078:RT2163613] java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at oracle.apps.xdo.common.xml.XSLT10gR1.invokeNewXSLStylesheet(XSLT10gR1.java:611)
    at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:239)
    at oracle.apps.xdo.common.xml.XSLTWrapper.transform(XSLTWrapper.java:182)
    at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:1044)
    at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:997)
    at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:212)
    at oracle.apps.xdo.template.FOProcessor.createFO(FOProcessor.java:1665)
    at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:975)
    at oracle.apps.xdo.oa.schema.server.TemplateHelper.runProcessTemplate(TemplateHelper.java:5936)
    at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3459)
    at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3548)
    at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:302)
    at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:176)
    Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'ref' used but not declared.
    at oracle.xdo.parser.v2.XSLProcessor.reportException(XSLProcessor.java:806)
    at oracle.xdo.parser.v2.XSLProcessor.newXSLStylesheet(XSLProcessor.java:571)
    ... 17 more
    I am pretty sire the PL/SQL is OK beacuse if I run without a template the XML output is displayed as expected.
    Would anyone have any ideas on this?

    Here's your problem:
    "Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'ref' used but not declared.
    at oracle.xdo.parser.v2.XSLProcessor.reportException(XSLProcessor.java:806)
    at oracle.xdo.parser.v2.XSLProcessor.newXSLStylesheet(XSLProcessor.java:571)
    What version of BIP Desktop are you using? From the error message it appears to be Template builder for Word 11.1.1.3. eBS is probably using 5.6.3 .
    Try this - edit the fields in the template using MS Word. Under Help or Status, remove tags that contain <?ref.....?>. Save and upload the template.
    Hope this helps. If this works, please don't forget to give me points for the right answer.

  • Applying an XSL using PL/SQL

    I've got a question about the XML toolkit.
    I want to apply an XSL stylesheet on an XML document internally in the database using PL/SQL.
    I've got an application that must work with XML internally but its output must be anything. (CSV, XML, WML etc).
    Normally (when using IE 5.x) the stylesheet is applied when the document is parsed. I want to do this internally in the database.
    Is this possible? And does anyone have examples of this?
    THanks in advance.
    Martin Kleinman,
    Webdeveloper, Desyde BV, Baarn

    Dup post. Posted in AQ forum at {thread:id=1126132}

  • Declaring variable using Dynamic SQL

    Hi guys,
    I need to declare a variable base on a result.
    <snipplet>
    DECLARE
    v_objname VARCHAR2(50);
    BEGIN
    SELECT OBJECT_NAME
    INTO v_objname
    FROM USER_OBJECTS
    WHERE OBJECT_ID = 'xxx'
    AND OBJECt_TYPE = 'TABLE';
    -- now i need to declare a rowtype variable base on the objname
    -- e.g v_rowname v_objname%ROWTYPE;
    </snipplet>
    q1) May i know how do i do that ?
    Regards,
    Noob

    This sounds like a precursor to building a "generic" piece of code. As Boneist says... Bad Idea.
    If dynamically generated queries really need to be written (justify why first!) and you're not sure of the columns that are going to be returned, then you would preferably use the DBMS_SQL package to build the query and use positional notation to obtain the data from the dynamic columns, using the describe ability of dbms_sql to get information on the column types etc.
    e.g.
    (From my standard answers...)
    As sys user:
    CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    /As myuser:
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;This allows for the header row and the data to be written to seperate files if required.
    e.g.
    SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
    PL/SQL procedure successfully completed.Output.txt file contains:
    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
    Adapt to output different datatypes and styles are required.
    I have never found any need, ever* to have to write dynamic PL/SQL code. It just shouldn't be necessary. If you're finding yourself heading in that direction, seriously take a step back and re-consider your design and what it actually is you're trying to achieve. There almost always will be a better way.

Maybe you are looking for