Creating XML report using PL/SQL Stored Procedure

Hi Friends,
I am working on an xml report with the xml source as PL/SQL Stored Procedure.
I am referring the exercise shown in the following link to understand the process:
   http://orclapp.blogspot.com/2012/02/developing-xml-publisher-report-using.html
In the example shown in the above link I could not understand the following:
1) In the following procedure, the out parameter 'retcode' is not used at all.
   What is the importance of this parameter.
    PROCEDURE REPORT (errbuf  OUT VARCHAR2, retcode  OUT VARCHAR2, p_product_id   IN     NUMBER)
2)  After the xml data is prepared and put to 'l_result' Clob variable, the following
    Loop is executed. I am not able to appreciate why the following loop is required.
     LOOP
         EXIT WHEN l_length = l_retrieved;
         IF (l_length - l_retrieved) < 32000
         THEN
            SELECT SUBSTR (l_result, l_retrieved + 1) INTO l_xmlstr FROM DUAL;
            l_retrieved := l_length;
            fnd_file.put_line (fnd_file.output, l_xmlstr);
         ELSE
            SELECT SUBSTR (l_result, l_retrieved + 1, l_offset)
              INTO l_xmlstr
              FROM DUAL;
            l_retrieved := l_retrieved + l_offset;
            fnd_file.put_line (fnd_file.output, l_xmlstr);
         END IF;
     END LOOP;
3) In the example it is not explained how the concurrent program gets the xml data?
   I assume it is written to a file using the following line of code:
    fnd_file.put_line (fnd_file.output, l_xmlstr);
   I would appreciate if anyone can throw some light into my above queries so that I can understand the process clearly.
Thanks & Regards
Hawker

Hi 32000 in the code is a 'safe' size smaller than the max available 32767, the loops purpose is to move through the entire thing in chunks that will be manageable in the limits of the data type.
Btw; if you are in Oracle e-business suite then you can also use Oracle reports very simply to create XML output.
If you have reports developer all you need to do is put raw sql (without any 'artifice' to create XML) in the report SQL and then set the reports output to XML in the program definition in Oracle e-business.
best regards,
Robert.

Similar Messages

  • BO v5.1 - creating a report from an oracle stored procedure

    Post Author: newrochelle
    CA Forum: Publishing
    hi to all,
    im using BO 5.1 and i need to create a document from an oracle stored procedure that have only one IN parameter and ten OUT parameters.
    Creating the new report I selected the database connection then I choose the stored procedure name from the list, I inserted the value for the IN parameter and finally I click on Run button.
    I got the following error message:
    ORA-06550: line 1, column 38: :PLS-00103: Encountered the symbol
    "," when expecting one of the following: : : ( - + case mod
    new not null others <an identifier> : <a double-quoted
    delimited-identifier> <a bind variable> avg : count current
    exists max min prior sql stddev sum variance : execute forall
    merge time timestamp interval date : <a string literal with
    character set specification> : <a number> <a single-quoted SQL
    string> pipe : <an alternatively-quoted string literal with
    character set specification> : <an alternatively-q :-6550
    it seems to be caused by the OUT parameters!
    i leaved them without any value.
    it's the first time that I used a stored procedure to create a BO report, but I think the OUT parameters are needed to do that, otherwise what data will be presented in the report???
    can you help me?
    please answear me ASAP.
    Thank's in advance
    Regards
    Andrea

    Post Author: synapsevampire
    CA Forum: Publishing
    Try posting in a BO forum, this is Crystal Reports.
    -k

  • SQL Adapter Crashes with large XML set returned by SQL stored procedure

    Hello everyone. I'm running BizTalk Server 2009 32 bit on Windows Server 2008 R2 with 8 GB of memory.
    I have a Receive Port with the Transport Type being SQL and the Receive Pipeline being XML Receive.
    I have a Send Port which processes the XML from this Receive Port and creates an HIPAA 834 file.
    Once a large file is created (approximately 1.6 GB in XML format, 32 MB in EDI form), a second file 1.7 GB fails to create.
    I get the following error in the Event Viewer:
    Event Type: Warning
    Event Source: BizTalk Server 2009
    Event Category: (1)
    Event ID: 5740
    Date:  10/28/2014
    Time:  7:15:31 PM
    User:  N/A
    The adapter "SQL" raised an error message. Details "HRESULT="0x80004005" Description="Unspecified error"
    Is there a way to change some BizTalk server settings to help in the processing of this large XML set without the SQL adapter crashing?
    Paul

    Could you check Sql Profiler to trace or determine if you are facing deadlock?
    Is your Adapter running under 64 bits?
    Have you studied the possibility of using SqlBulkInser Adapter?
    http://blogs.objectsharp.com/post/2005/10/23/Processing-a-Large-Flat-File-Message-with-BizTalk-and-the-SqlBulkInsert-Adapter.aspx

  • Run Authorware using an SQL stored procedure

    I have an Authorware piece that reads a text file, performs
    some calculations, generates a .bmp , writes an output text file,
    and then closes. I would like to trigger this using an SQL Server
    stored procedure. The piece works fine if it is run directly, but
    the stored procedure does not run the Authorware program (though I
    can run a variety of other applications using similar stored
    procedures). Is it possible to call and run Authorware pieces from
    other applications?
    Thanks,
    David

    If I were to make a bet, I would say the issue is related to ODBC. Can you get access to you database using ADO directly? This removes two pieces: the ODBC drivers and the SQL Toolbox.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Is i possible to base a report on a pl/sql stored procedure

    Is i possible to base a report on a pl/sql stored procedure?
    If Yes please give directions on how to do it.
    /morten

    Hello Morten,
    In Reports 9i, with new feature JDBCPDS its possiable to create a report against a existing stored procedure.
    Using JDBCPDS, user can access any JDBC-enabled data source. You can access database like Oracle, DB2, Sybase, ODBC Data Sources, etc using supporting
    JDBC Drivers. User can also connect ODBC Data Sources like SQL Server, MS-Access, Excel etc.
    User can create a JDBC Query angainst a SQL Query or Stored Procedure in any of mentioned dataSource.
    Following is the syntax of the Oracle Stored Procedure, which can be used as Data Source with JDBCPDS.
    Steps to create a JDBCPDS Report through Report Builder : http://otn.oracle.com:8877/reports/help/ - > JDBCPDS- > How To
    //----------Package definition for Ref cursor ----------/
    package test_Procedure as
    type empcurProcedure5 is ref cursor;
    end test_tryProcedure5;
    // -----------Procedure definition ---------//
    test_Procedure(p_emp_cv out test_tryProcedure5.empcurProcedure5,
    p1 in NUMBER) is
    begin
    update emp set sal=sal + 50 where deptno > P1
    open p_emp_cv for select * from emp where deptno > P1;
    end test_Procedure;
    Procedure first parameter will be Ref Cursor and will be used to return the resultSet to JDBC Query.
    User should create first this procedure in Database. Then in JDBC Query Dialog, user can call this stored procedure by specifying procedure name.
    test_Procedure(40)
    Please see ORACLE_HOME/reports/conf/jdbcpds.conf for more Connection and
    JDBC-Driver information.
    With Regards
    Reports Team

  • How to create an External Content Type with SQL Stored Procedures Parameters and query it in a SharePoint App

    Hi,
    I'm new to SharePoint 2013 I want to be able to query a MSSQL database from a SharePoint App I have tried to create an External Content Type (ECT) which is produced from a MSSQL stored Procedure, this procedure has several parameters which are needed to
    filter the data correctly.  From here I want to produce an external list which I can then query from a c# SharePoint app.  If I leave the filters in the ECT null then the list is of course empty or if enter a default values the results are limited
    for the app to query so are no good.
    I want to dynamically pass values to the ECT when querying from the app, is this not possible.  Should I just be returning everything in an external list and then letting the query in the app filter the data, this seems inefficient?
    Is this the best way to do this or should I be doing this differently?
    Please can someone point me in the right direction.
    Thanks

    Hi Pandra801,
    When you create a the external content type, please try to add a filter based on your select statement.
    http://arsalkhatri.wordpress.com/2012/01/07/external-list-with-bcs-search-filters-finders/
    Or, try to create a stored procedure based on your select statement, then create ECT using the SQL stored procedure.
    A step by step guide in designing BCS entities by using a SQL stored procedure
    http://blogs.msdn.com/b/sharepointdev/archive/2011/02/10/173-a-step-by-step-guide-in-designing-bcs-entities-by-using-a-sql-stored-procedure.aspx
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Can't create valid PL/SQL stored procedure

    I have two questions about PL/SQL and JDBC:
    Question 1: I'm trying to create and execute a PL/SQL stored procedure, and I can't seem to get the syntax right. I'm trying to create the simplest stored proc I can. Here's the stored procedure:
    create or replace procedure test( inParam char(20) ) is
    begin
    select inParam from dual;
    end;
    When I try to execute it, I'm getting the error:
    PLS-00905: object TEST is invalid
    The creation of the proc, and the execution are being done using the same login.
    Question2: Once I get the stored procedure created, I want to call it from a JDBC application. Is this the correct syntax:
              CallableStatement stmt = connection.prepareCall("begin test('abc'); end;");
    or can I use the standard JDBC escape sequence:
              CallableStatement stmt = connection.prepareCall("{ call test('abc'); }");
    Thanks for your help,
    Jeff

    Forgot to mention, I'm using TimesTen 11.2.1.4.

  • Report Using PL/SQL Region

    Hi,
    I have bit experiment create custom reports using PL/SQL region
    http://dbswh.webhop.net/apex/f?p=BLOG:READ:0::::ARTICLE:97800346956448
    I would like have from you tips and ideas how enhance this.
    Because I'm not so good with SQL,
    I really appreciate if you have tips enhance performance for query used for cursor.
        /* Report query */
        l_sql := '
          SELECT * FROM(
            SELECT a.*, row_number() OVER (ORDER BY '
            || l_sort_col
            || ' '
            || l_sort_ord
            || ') rn, COUNT(1) over() mrn
            FROM(' || l_sql || ') a
          ) WHERE rn BETWEEN ' || l_start_row || ' AND ' || l_last_row
        ; Regards,
    Jari

    Hi Jari
    I'm guessing you're trying to do paginated grid data or somewthing similar? You could try something like this...
        l_sql := 'SELECT * '||
               'FROM ('||
                      'SELECT /*+ FIRST_ROWS(n) */ '||
                              'a.*, ROWNUM rnum '||
                       'FROM ('||l_sql||' '||
                              'ORDER BY '||l_sort||' '||l_dir||') a '||
                       'WHERE ROWNUM <= '||l_max_row||') '||
               'WHERE rnum >= '||l_start;The variables would be initialized in the procedure as follows...
        l_max_row := p_start + p_limit;
        l_start   := p_start + 1;
        l_sort    := NVL(p_sort,'1');
        l_dir     := NVL(p_dir, 'ASC');My application process would be called something like follows, to spit out a JSON object...
    BEGIN
      htp.p(wwv_flow.g_widget_num_return||'(');
      munky_extjs.grid_json(p_app_id => wwv_flow.g_x01,
                        p_app_page_id => wwv_flow.g_x02,
                        p_region_id => TO_NUMBER(wwv_flow.g_x03),
                        p_start => NVL(wwv_flow.g_x04,0),
                        p_limit => NVL(wwv_flow.g_x05,10),
                        p_sort => wwv_flow.g_x06,
                        p_dir => wwv_flow.g_x07);
      htp.p(')');
    END;I think your use of analytics in the inner query may be slowing you down if you have a lot of data?
    Cheers
    Ben

  • MS SQL Stored Procedure problem

    Hi,
    I am using BO XI R2, Crystal Report XI and MS SQL Database.
    I found a strange error when generating the report using my java application if the crystal report is using MS SQL stored procedure. The error encountered :
    com.crystaldecisions.sdk.occa.managedreports.ras.internal.a: Cannot open report document. --- Custom table prefix specified in the InfoStore does not exist.  This is a configuration problem. Please contact your system administrator.
    cause:com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Custom table prefix specified in the InfoStore does not exist.  This is a configuration problem. Please contact your system administrator.---- Error code:-2147467259 Error code name:failed
    detail:Cannot open report document. --- Custom table prefix specified in the InfoStore does not exist.  This is a configuration problem. Please contact your system administrator.
    This is when the code executed is:
       reportClientDocument = reportAppFactory.openDocument(report, 0, Locale.ENGLISH);
    If the report does not use the stored procedure, it's ok.
    If i run the report  (with stored procedure) from CMC using the default table prefix (in database config tab), it's able to generate the report.
    If i select custom table prefix and specify the custom table prefix value with the same value as in the default table prefix, it could not generate the report and error stated that the table could not be found.
    Please enlighten me if you have use MS SQL database for reporting with BO XI R2.
    Thanks.

    That means it's not a SDK-specific error. 
    Once it's resolved in InfoView, it'll likely be resolved with your app.
    You might want to open a support case with SAP. 
    Sincerely,
    Ted Ueda

  • Pass date range parameter  to SQL stored procedure.

    Hi,
    I'd like to pass a date range parameter from Crystal Reports to a sql stored procedure. Does anyone know if this is possible?
    I've had no problem passing standard datetime (single value) paramaters to and from but am struggling with getting a range value parameter to work.
    Environment: Crystal Reports 10/XI and SQL 2000 MSDE version or SQL 2005 Express Edition.
    Any help would be appreciated.

    C5112736 wrote:>
    > And then these 2 formulas 'Formula # 1' and 'Formula # 2' can be used to pass on to the stored procedure.
    Can someone please demonstrate exactly how to use formula results as date parameters to a SQL stored procedure?  Keep in mind, there are two parameters to the stored procedure.
    I have gleaned this much: Use Add Command and insert the procedure with
    EXEC ServerName.dbo.usp_sprocName;1 '{?StringParameter}'
    but if I try to do
    {CALL ServerName.dbo.usp_SprocName({@Formula1},{@Formula2})}
    then it gives the error "No value given for one or more required parameters". 
    Both of the parameters are VARCHAR(50).
    I have finally found this link: [http://msdn.microsoft.com/en-us/library/ms710248(VS.85).aspx|http://msdn.microsoft.com/en-us/library/ms710248(VS.85).aspx]
    This Microsoft site defines the format of the ODBC escape sequences, but I still do not know how to convince Crystal to insert it's parameter results or formula results.
    Pulling what's left of my hair out . . .
    ~ Shaun

  • PL/SQL Stored procedures vs C# code.

    Hi All
    We are going to start designing a kind of transactional application with huge volume of data (150 million records per month). Our selected DB engine is Oracle 10.g while C# is selected development language.
    Because of big volume of data performance is one of the most important factors for us, and the technical design should gain the best level of performance.
    What i'm looking for and studing for it is to define which kind of operation shall be done by Stored Procedure which will be written by PL/SQL or by C# classes?
    I don't interested in to handle complicated and complex jobs using PL/SQL stored procedures while the performance really deserve it.

    Hello,
    Well, my philosophy is to leverage the database as much as possible. I have worked with applications that had no "select", "insert", "update" or "delete" statements in them. Instead, stored procedures and functions inside of PL/SQL packages and bodies were used. Some people will argue strongly against that, but I belong to the "thick database" group rather than the "the database is just a persistence layer that I have to deal with" group. To me it makes sense to co-locate the code that works on the data with the data. If you are working with large volumes of data, I find the bulk operations available via PL/SQL to be very handy.
    Here's an AskTom thread that deals with this general issue:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:12083187196917
    Whilst the thread is primarily about Java, you can substitute just about any other language and the meaning will still carry over.
    Regards,
    Mark

  • Unable to use the values returned by a PL/SQL stored procedure in a XSQL page

    Hi,
    I've been messing around with XML and XSQL in particular. I was trying to write a xsql page to display a report with account totals...I have the following .xsql which calls a PL/SQL stored procedure :
    <?xml version="1.0"?>
    <xsql:query connection="pfcdm" xmlns:xsql="urn:oracle-xsql">
    <xsql:set-session-param name="zasset_total" value="100">
    <xsql:dml connection="pfcdm">
    rraman.sp_vw_id(zasset_total,zinvm_total,zmkt_val);
    </xsql:dml>
    </xsql:set-session-param>
    select 'Asset total is {@zasset_total}' as "ASSET_TOTAL" from dual
    </xsql:query>
    My procedure sp_vw_id returns the values that it should. But, I am not sure how to declare variables within a page, and to output the return values. There is very scanty documentation on the usage of <xsql:dml> or <xsql:ref-cursor-function>.
    Any response would be greatly appreciated.
    Thanks,
    Raja

    Here is the example from the Oracle9i (complete rewrite) of the XSQL Chapter in our Oracle documentation.
    Question
    I using <xsql:dml> to call a stored procedure which has one OUT parameter, but I was not able to see any results. The executed code results in the following statement:
    <xsql-status action="xsql:dml" rows="0"/>
    Answer
    You cannot set parameter values by binding them in the position of OUT variables in this release using <xsql:dml>. Only IN parameters are supported for binding. You can create a wrapper procedure that constructs XML elements using the HTP package and then your XSQL page can invoke the wrapper procedure using <xsql:include-owa> instead.
    For an example, suppose you had the following procedure:
    CREATE OR REPLACE PROCEDURE addmult(arg1 NUMBER,
    arg2 NUMBER,
    sumval OUT NUMBER,
    prodval OUT NUMBER) IS
    BEGIN
    sumval := arg1 + arg2;
    prodval := arg1 * arg2;
    END;You could write the following procedure to "wrap" it, taking all of the IN arguments that the procedure above expects, and then "encoding" the OUT values as a little XML datagram that you print to the OWA page buffer:
    CREATE OR REPLACE PROCEDURE addmultwrapper(arg1 NUMBER, arg2 NUMBER) IS
    sumval NUMBER;
    prodval NUMBER;
    xml VARCHAR2(2000);
    BEGIN
    -- Call the procedure with OUT values
    addmult(arg1,arg2,sumval,prodval);
    -- Then produce XML that encodes the OUT values
    xml := '<addmult>'&#0124; &#0124;
    '<sum>'&#0124; &#0124;sumval&#0124; &#0124;'</sum>'&#0124; &#0124;
    '<product>'&#0124; &#0124;prodval&#0124; &#0124;'</product>'&#0124; &#0124;
    '</addmult>';
    -- Print the XML result to the OWA page buffer for return
    HTP.P(xml);
    END;This way, you can build an XSQL page like this that calls the wrapper procedure:
    <page connection="demo" xmlns:xsql="urn:oracle-xsql">
    <xsql:include-owa bind-params="arg1 arg2">
    BEGIN addmultwrapper(?,?); END;
    </xsql:include-owa>
    </page>This allows a request like:
    http://yourserver.com/addmult.xsql?arg1=30&arg2=45
    to return an XML datagram that reflects the OUT values like this:
    <page> <addmult><sum>75</sum><product>1350</product></addmult>
    </page>

  • 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

  • Actuate 7 PL/SQL Stored Procedure Call Before the Report Run.

    Hi,
    I need a small help to call a pl sql stored procedure in actuate 7.
    I wrote a code a on component content
    Function runProc(procName as String, connection As AcDBConnection )
    ' Insert your code here
    Dim statement As AcDBStatement
    Dim results as string
    ' Prepare statement
    Set statement = connection.Prepare("BEGIN " & procName & "; END;" )
    If statement Is Nothing Then
    results = "Failed to prepare statement."
    results = results & " " & connection.GetSpecificErrorText( )
    results = results & " " & connection.GetGeneralErrorText( )
    Exit sub
    End If
    ' Execute sprocoutparam
    If statement.Execute() = 0 Then
    results = "Stored procedure " & procName & "execution failed."
    results = results & " " & connection.GetSpecificErrorText( )
    results = results & " " & connection.GetGeneralErrorText( )
    Else
    results = "Stored procedure " & procName & " execution success."
    End if
    ShowFactoryStatus(results)
    End FunctionNow this Code I am calling on the Chart Start Method
    Sub Start( )
        Super::Start( )
        ' Insert your code here
        Dim ProcName as String
        Dim connectionObject As AcDBConnection
        ProcName="DELETECUSTOMER(1234)"
        runProc(ProcName, connectionObject )
    End SubNow when i Run the Report i get this Error !
    NewReportApp::Frame::Chart%Start(9): Invalid procedure reference. - (runProc)
    1 Semantic Error(s) found
    Thanks,
    Asif

    hi,
    Finally Figured Out Here....
    Steps to Call the Stored Procedure In Actuate 7
    1 – Right Click on Content – Frame and go to properties and method Tab.
         1 – Click on New Button to you create own custom method.
         2 – Write the following code :
    Sub runProc(procName as String, connection As AcDBConnection )
         Dim statement As AcDBStatement
         Dim results as string
         Set connection = GetConnection()
         'Prepare statement
         Set statement = connection.Prepare("BEGIN " & procName & "; END;" )
              If statement Is Nothing Then
                   results = "Failed to prepare statement."
                   results = results & " " & connection.GetSpecificErrorText( )
                   results = results & " " & connection.GetGeneralErrorText( )
                   MsgBox "Procedure Not Called....Badddddd"
                   Exit sub
              End If
         ' Execute sprocoutparam
              If statement.Execute() = 0 Then
                   results = "Stored procedure " & procName & "execution failed."
                   results = results & " " & connection.GetSpecificErrorText( )
                   results = results & " " & connection.GetGeneralErrorText( )
                   MsgBox "Procedure Not Called....Badddddd" & results
              Else
                   results = "Stored procedure " & procName & " execution success."
                   MsgBox "Procedure Called....Wowwww"
              End if
              ShowFactoryStatus(results)
    End Sub2 – Now let call the stored procedure before our actual report query runs.
         1 - Right Click on Content – Frame and go to properties and method Tab.
         2 - Select the Start Method and Click on Override button.     
         3 - Write the following code:
    Sub Start( )
         Dim ProcName as String
         Dim connectionObject As AcDBConnection
         Set connectionObject = GetConnection()
         ProcName="XXTEST ()"
         runProc( ProcName, connectionObject )
        Super::Start ( )
    End Sub3 – Now design your report as usual using the Textual Query window.

  • Support a singly report on SQL Stored Procedure and Oracle Stored Procedure

    Hi,
    I have a requirement in which I need to create a report that will run both on oracle and sql server.
    Report is designed as follows.
    Main report contain 2 sub-reports.Sub-reports are  based on stored procedure that takes three input parameters(beginDate,endDate and hostname which is a comma-separated string).
    Main report also have three parameters (beginDate,endDate and hostnameList) that I am linking with both sub-reports.
    Since the crystal picks the same name of the parameter as we define in procedure it showing '@' symbol in all the parameters when I change the datasoure from oracle to sql server and that's why sub reports defined in main report loose all the linking and same happens when I switch from sql to oracle since in case of oracle it does not have '@' symbol in variable name.
    How can I have one report that work with both DBs without loosing the links.
    Any help will be appreciated.
    Thanks,
    Amrita

    There is no way of doing this in CR. At least not that I've ever heard of anyway.
    If you REALLY need to make this work and it REALLY has to be just 1 report... Here is what I'd do...
    In the SQL Server database, add a new table that contains the same columns that are being returned by the sp's. If you can't add new tables to the database, use a different database or server...
    Create a Linked Server linking the Oracle db to SQL Server. (If you take the 3rd server rout, do the same with the SQL Server)
    Write a new sp that will accept the {?WhichServer} parameter and populate the new table with the result set.
    Then just query that table for your report.
    I know this probably isn't the rout you were wanting to take but it should work...
    Jason

Maybe you are looking for