SQL Procedure in Query

Hi experts
I have a procedure in SQL that I want to run in Query of SAP b1. I am using exec [procedure name] [parameters] . It is executing properly. but I want to add choose list with parameter. Like parameter is empcode then Query should show empcode list like in normal query. In sql procedure how I can do ?
Thanks
Best Regards
Jitender

Thanks Neetu for reply
My SQL procedure is running fine. It has no problem. I want Choose list with SQL procedure parameters.
-- exec leave_status '27515/43'
ALTER proc [dbo].[Leave_status]
@empCode Varchar(30)
--@empname varchar(50)
as
begin
                    create table #temp
                         empcode               varchar(40),
                         empName               varchar(50),
                         Branch               varchar(40),
                         DateOfLeave          Datetime,
                         LeaveType          varchar(2),
                         CL_Balance     numeric(10,2),
                         EL_Balance     Numeric(10,2)
               insert into #temp (empcode, empname, Branch     ,dateofleave)
               select T0.[U_empCode],T3.[firstName]+ T3.[lastName],T4.[Name] ,   T0.[U_AtnDate]
               FROM     [dbo].[@BIZ_ATREG]  T0 ,
                         OHEM T3 INNER JOIN OUBR T4 ON T3.branch = T4.Code
               Where    T3.[U_empCode]=  T0.[U_empCode]
               and           T0.[U_sttsCd] = 'L'
               and      T0.[U_empCode]= @empCode
               update T0
               set leaveType = T2.[U_LcCode]
               from #temp T0,
                    [dbo].[@BIZ_OLVR] T1 ,
                    [dbo].[@BIZ_LVR1]  T2
               where          T1.[Code] = T2.[Code]
                    and          T0.dateofleave between U_Dtfrm and U_DtTo
               declare @maxDateCL  datetime, @MaxDateEL Datetime ,@CL_Avail     numeric(10,2),@EL_Avail     numeric(10,2)
                select @maxdateCL = max(U_dtto) from  [dbo].[@BIZ_OLVR] T1 ,[dbo].[@BIZ_LVR1]  T2
               where          T1.[Code] = T2.[Code] and     T2.U_LcCode = 'CL' and T1.[U_empCode]= @empCode
                select @maxdateEL = max(U_dtto) from  [dbo].[@BIZ_OLVR] T1 ,[dbo].[@BIZ_LVR1]  T2
               where          T1.[Code] = T2.[Code] and     T2.U_LcCode = 'EL' and T1.[U_empCode]= @empCode
               update T0
               set CL_Balance = (select U_balance
                    from
                    [dbo].[@BIZ_OLVR] T1 ,
                    [dbo].[@BIZ_LVR1]  T2
               where          T1.[Code] = T2.[Code]
                    and          T2.U_LcCode = 'CL'
                    and     T1.U_dtto= @maxdateCL
                     and  T1.[U_empCode]= @empCode
               from #temp T0
               update T0
               set EL_Balance = (select U_balance
                    from
                    [dbo].[@BIZ_OLVR] T1 ,
                    [dbo].[@BIZ_LVR1]  T2
               where          T1.[Code] = T2.[Code]
                    and          T2.U_LcCode = 'EL'
                    and     T1.U_dtto= @maxdateEL
                     and  T1.[U_empCode]= @empCode
               from #temp T0
                    select @CL_Avail = count(*) from #temp where leaveType = 'CL'
                    select @EL_Avail = count(*) from #temp where leaveType = 'EL'
select *, @CL_Avail as 'CL Avail', @EL_Avail as 'EL Avail' from #temp order by dateofleave
end
To Execute in Query I use this statement exec exec [dbo].[Leave_status] '27515/27'

Similar Messages

  • Include Button that executes PL/SQL procedure to SQL query based region

    I would like to add two columns to a SQL query region.
    These columns would not be sourced from the query, but rather would be used to execute a PL/SQL procedure.
    For example, I would like to have a manager approve or deny adding an additional employee to the department.
    There would be one button for APPROVE. And, one button for DENY.
    The PL/SQL procedure would execute to perform the required DML based upon the selected action (either APPROVE or DENY).
    A sample output would look like this:
    <APPROVE>, <DENY>, John Doe, Accountant
    <APPROVE>, <DENY>, Jane Doe, Accountant
    Is there any way to add a button to a SQL Query based report region where that button executes a stored proc? If so, what is the basic process for doing this?
    Thanks!
    -Reid

    Is there any way to add a button to a SQL Query based report region where that button executes a stored proc? If so, what is the basic process for doing this?Conditional page item? You can associate processes with buttons on a page

  • Setting pl/sql procedure as the data source in a Report Query

    Is there a way to set PL/SQL as the data source in a Report Query? we want to
    able to use the ReportQuery function and query results returned by a PL/SQL procedure.
    thanks

    Not exactly sure what you want to do, but on a ReportQuery you can set either a StoredProcedureCall, or an SQLCall.
    query.setCall(new StoredProcedureCall(...));
    query.setCall(new SQLCall("begin; my_proc(); end"));
    Now, a stored procedure in Oracle cannot return a result, so using a ReportQuery which requires a result may not make sense.
    You could instead use a DataModifyQuery.
    If you return results through output parameters (you must use a StoredProcedureCall for this) you could use a DataReadQuery or a ReadAllQuery/ReportQuery if you wish to build objects from the data.
    James : http://www.eclipselink.org

  • How to convert my query to SQL Procedure

    Hi all,
    I am running an SQL Query in my page process to set few items on my page.
    begin
    declare
    l_vc_arr2 APEX_APPLICATION_GLOBAL.VC_ARR2;
    begin
    IF APEX_APPLICATION.G_F01.COUNT = 0 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a email template to edit!!!');
    END IF;
    IF APEX_APPLICATION.G_F01.COUNT > 1 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a single email template to edit at a time!!!');
    END IF;
    FOR i in 1..APEX_APPLICATION.G_F01.count
    LOOP
    l_vc_arr2 := APEX_UTIL.STRING_TO_TABLE(APEX_APPLICATION.G_F01(i),'$');
    :P32_SUBJECT := l_vc_arr2(1);
    :P32_TYPE := l_vc_arr2(2);
    :P32_BODY := l_vc_arr2(3);
    END LOOP;
    end;
    end;
    It is running perfectly fine. Now i want to convert this query into custom procedure. I am writing follwing code to create SQL Procedure,
    create or replace
    procedure Edit_EmailTemplate as
    begin
    declare
    l_vc_arr2 APEX_APPLICATION_GLOBAL.VC_ARR2;
    begin
    IF APEX_APPLICATION.G_F01.COUNT = 0 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a email template to edit!!!');
    END IF;
    IF APEX_APPLICATION.G_F01.COUNT > 1 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a single email template to edit at a time!!!');
    END IF;
    FOR i in 1..APEX_APPLICATION.G_F01.count
    LOOP
    l_vc_arr2 := APEX_UTIL.STRING_TO_TABLE(APEX_APPLICATION.G_F01(i),'$');
    v(P32_SUBJECT) := l_vc_arr2(1);
    v(P32_TYPE) := l_vc_arr2(2);
    v(P32_BODY) := l_vc_arr2(3);
    END LOOP;
    end;
    end;
    but it is not getting compiled. Do anyone know what the problem is???
    With Regards,
    Sunil Bhatia

    hey thanks,
    but my problem is not of creating,
    it has been created and i can see it in sql browser. but it is not getting compiled
    it is returning with the following error
    Compilation failed,line 18 (13:22:08)
    PLS-00306: wrong number or types of arguments in call to 'V'Compilation failed,line 18 (13:22:08)
    PL/SQL: Statement ignoredCompilation failed,line 19 (13:22:08)
    PLS-00306: wrong number or types of arguments in call to 'V'Compilation failed,line 19 (13:22:08)
    PL/SQL: Statement ignoredCompilation failed,line 20 (13:22:08)
    PLS-00306: wrong number or types of arguments in call to 'V'Compilation failed,line 20 (13:22:08)
    PL/SQL: Statement ignored
    my statement is
    create or replace
    procedure Edit_EmailTemplate as
    begin
    declare
    l_vc_arr2 APEX_APPLICATION_GLOBAL.VC_ARR2;
    begin
    IF APEX_APPLICATION.G_F01.COUNT = 0 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a email template to edit!!!');
    END IF;
    IF APEX_APPLICATION.G_F01.COUNT > 1 THEN
    RAISE_APPLICATION_ERROR(-20001, 'Please select a single email template to edit at a time!!!');
    END IF;
    FOR i in 1..APEX_APPLICATION.G_F01.count
    LOOP
    l_vc_arr2 := APEX_UTIL.STRING_TO_TABLE(APEX_APPLICATION.G_F01(i),'$');
    v('P32_SUBJECT') := l_vc_arr2(1);
    v('P32_TYPE') := l_vc_arr2(2);
    v('P32_BODY') := l_vc_arr2(3);
    END LOOP;
    end;
    end;

  • How to call a PL/SQL procedure from a xml Data Template

    We have a requirement in which we need to call a pl/sql package.(dot)procedure from a Data Template of XML Publisher.
    we have registered a Data Template & a RTF Template in the XML Publisher Responsibility in the Oracle 11.5.10 instance(Front End).
    In the Data Query part of the Data Template , we have to get the data from a Custom View.
    This view needs to be populated by a PL/SQL procedure.And this procedure needs to be called from this Data Template only.
    Can anybody suggest the solution.
    Thanks,
    Sachin

    Call the procecure in the After Parameter Form trigger, which can be scripted in the Data Template.
    BTW, there is a specialized XML Publisher forum:
    BI Publisher

  • PL/SQL procedure is 10x slower when running from weblogic

    Hi everyone,
    we've developed a PL/SQL procedure performing reporting - the original solution was written in Java but due to performance problems we've decided to switch this particular piece to PL/SQL. Everything works fine as long as we execute the procedure from SQL Developer - the batch processing 20000 items finishes in about 80 seconds, which is a serious improvement compared to the previous solution.
    But once we call the very same procedure (on exactly the same data) from weblogic, the performance seriously drops - instead of 80 seconds it suddenly runs for about 23 minutes, which is 10x slower. And we don't know why this happens :-(
    We've profiled the procedure (in both environments) using DBMS_PROFILER, and we've found that if the procedure is executed from Weblogic, one of the SQL statements runs noticeably slower and consumes about 800 seconds (90% of the total run time) instead of 0.9 second (2% of the total run time), but we're not sure why - in both cases this query is executed 32742-times, giving 24ms vs. 0.03ms in average.
    The SQL is
    SELECT personId INTO v_personId FROM (            
            SELECT personId FROM PersonRelations
            WHERE extPersonId LIKE v_person_prefix || '%'
    ) WHERE rownum = 1;Basically it returns an ID of the person according to some external ID (or the prefix of the ID). I do understand why this query might be a performance problem (LIKE operator etc.), but I don't understand why this runs quite fast when executed from SQL Developer and 10x slower when executed from Weblogic (exactly the same data, etc.).
    Ve're using Oracle 10gR2 with Weblogic 10, running on a separate machine - there are no other intensive tasks, so there's nothing that could interfere with the oracle process. According to the 'top' command, the wait time is below 0.5%, so there should be no serious I/O problems. We've even checked JDBC connection pool settings in Weblogic, but I doubt this issue is related to JDBC (and everything looks fine anyway). The statistics are fresh and the results are quite consistent.
    Edited by: user6510516 on 17.7.2009 13:46

    The setup is quite simple - the database is running on a dedicated database server (development only). Generally there are no 'intensive' tasks running on this machine, especially not when the procedure I'm talking about was executed. The application server (weblogic 10) is running on different machine so it does not interfere with the database (in this case it was my own workstation).
    No, the procedure is not called 20000x - we have a table with batch of records we need to process, with a given flag (say processed=0). The procedure reads them using a cursor and processes the records one-by-one. By 'processing' I mean computing some sums, updating other table, etc. and finally switching the record to processed=1. I.e. the procedure looks like this:
    CREATE PROCEDURE process_records IS
        v_record records_to_process%ROWTYPE;
    BEGIN
         OPEN records_to_process;
         LOOP
              FETCH records_to_process INTO v_record;
              EXIT WHEN records_to_process%NOTFOUND;
              -- process the record (update table A, insert a record into B, delete from C, query table D ....)
              -- and finally mark the row as 'processed=1'
         END LOOP;
         CLOSE records_to_process;
    END process_records;The procedure is actually part of a package and the cursor 'records_to_process' is defined in the body. One of the queries executed in the procedure is the SELECT mentioned above (the one that jumps from 2% to 90%).
    So the only thing we actually do in Weblogic is
    CallableStatement cstmt = connection.prepareCall("{call ProcessPkg.process_records}");
    cstmt.execute();and that's it - there is only one call to the JDBC, so the network overhead shouldn't be a problem.
    There are 20000 rows we use for testing - we just update them to 'processed=0' (and clear some of the other tables). So actually each run uses exactly the same data, same code paths and produces the very same results. Yet when executed from SQL developer it takes 80 seconds and when executed from Weblogic it takes 800 seconds :-(
    The only difference I've just noticed is that when using SQL Developer, we're using PL/SQL notation, i.e. "BEGIN ProcessPkg.process_records; END;" instead of "{call }" but I guess that's irrelevant. And yet another difference - weblogic uses JDBC from 10gR2, while the SQL Developer is bundled with JDBC from 11g.

  • Need help in writing a tricky sql/PL/Sql Procedure

    Hi,
    I have a Branch table with just two fields in it node1 and Node2, The table looks like this
    node1 | node2
    -------|---------
    1 | 2
    3 | 2
    3 | 4
    4 | 5
    1 | 5
    1 | 6
    5 | 6
    in the above data if you draw lines between node_1 and node_2 you will see that there are 3 different paths to get from 1 to 5, as follows
    /--------6-------\
    1----------------------5
    \2------3-------4/
    Now I need to Find all the nodes between 1 and 5 or all the possible paths from node 1 to node 5 in this case I have 3 possible paths they are as follows
    1-2-3-4-5
    1-3-5
    1-5
    Now I know if this data was stored in a hierarchical manner I can get the results i want by using CONNECT BY and SYS_CONNECT_BY_PATH.
    Is there a way to transform this data into a hierarchcal manner so that I can use the CONNECT BY or can somebody give me an Idea as to how to write a PL/SQL procedure to get the result I want.
    Any help will be greatly appreciated

    Hi!
    1.Create another table Branch1 to hold 'transformed data'.
    2.Use the following procedure to insert data into branch1 table.
    declare
    cursor n is select * from branch;
    begin
    for nrec in n loop
    if nrec.node1 = 5 then
         insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
    elsif nrec.node2= 5 then
         insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
    else
    if      nrec.node2> 5      then
         insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
    elsif nrec.node1> 5 then
         insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
    elsif (nrec.node1 < nrec.node2 ) then
         insert into branch1(node1,node2) values(nrec.node1,nrec.node2);
    else
         insert into branch1(node1,node2) values(nrec.node2,nrec.node1);
    end if;
    end if;
    end loop;
    commit;
    end;
    3.Then execute the following connect by query:
    SQL> select lpad(' ',level*2,' ')||node1 from branch1
    2 start with node1=1
    3 connect by prior node2=node1;
    Hope this is satisfactory.
    Thanks!

  • Link to PL/SQL procedure using a Template Manager template.

    Hi,
    I need to link a portal application report (report from SQL query) to a SQL procedure that uses a template manager template. The PL/SQL procedure requires parameters. I'm not be able to create a link based on a PL/SQL procedure. The only solution I found is to setup a link to a Form based on that procedure. But the form is only used to call the PL/SQL procedure by clicking the submit button and redirect to the template.
    Another question:
    Is it planed to support dynamic links based on column conditions?
    I'm using Portal release 3.0.7.6.2.
    thanks in advance
    Jens

    Jens,
    You may want to search the Oracle9iAS Portal Applications forum. It may have the answer you are looking for. This forum is for questions related to the Portal Development Kit.
    Thanks,
    Sue
    Sue

  • Passing table data to pl sql procedure oaf

    Hi All,
    I have a requirement where i have to pass table data to plsql procedure.
    In the first page i select the REQUISITION and click on RETURN button and it will take me to the next page.
    and in the Next page i will click on APPLY button.
    When i click on APPLY, it will call the procedure and will give input to the procedure whatever has been selected when i have selected requisition.
    Please help. Please tell me the approach how to get this task done. A sample code will work.
    Hope the requirement is clear.
    Thanks in Advance.

    Hi Chinmay,
    Refer below code for Your Requirement.
    //Code For Quering Data
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
    String Query = "SELECT organization_id FROM hr_operating_units WHERE organization_id = fnd_global.org_id";
    PreparedStatement stmt = conn.prepareStatement(Query);
    resultset=stmt.executeQuery();
    while (resultset.next())
    orgId = (String)resultset.getString("ORGANIZATION_ID").toString();
    conn.commit();
    catch(Exception e)
    e.printStackTrace();
    //Code for Pass Resulted column to Procedure Input for delete Particular Record
    Execute parameterized PL SQL procedure from OAF page
    Let us try to call PL/SQL package from OAF page. We will try to remove selected line from Database.
    Package Spec
    CREATE OR REPLACE PACKAGE APPS.genpack_pkg
    AS
    PROCEDURE roll_delete_proc (orgId IN VARCHAR2);
    END genpack_pkg;
    Package Body
    CREATE OR REPLACE PACKAGE BODY APPS.genpack_pkg
    AS
    PROCEDURE roll_delete_proc (orgId IN VARCHAR2)
    AS
    BEGIN
    DELETE FROM pklist_roll_details_temp
    WHERE roll_line_id = orgId;
    COMMIT;
    END roll_delete_proc;
    END genpack_pkg;
    //in Controller PFR
    import java.sql.CallableStatement;
    if (pageContext.getParameter("ActionsButton") != null)
    String val = pageContext.getParameter("ActionsChoice");
    if ("DELLN".equals(val))
    CallableStatement cstmt = null;
    for (OAViewRowImpl row = (OAViewRowImpl)tempvo.first(); row != null; row = (OAViewRowImpl)tempvo.next()) {
    if ((row.getAttribute("Selectflag") == null) ||
    (!row.getAttribute("Selectflag").toString().equals("Y"))) continue;
    try {
    int rollid = Integer.parseInt((String)row.getAttribute("orgId"));
    Connection conn = am.getOADBTransaction().getJdbcConnection();
    if (rollid == 1)
    temphm.put(row.getAttribute("orgId").toString(), row.getAttribute("PoNumber").orgId());
    tempvo.removeCurrentRow();
    else
    try
    StringBuilder sb = new StringBuilder();
    sb.append(rollid);
    String strI = sb.toString();
    System.out.println("Inside else in delete");
    cstmt = conn.prepareCall("{call GENPACK_PKG.tpc_roll_delete_proc(?)}");
    cstmt.setString(1, strI);
    System.out.println("Oracle Callable Statment Execution Init for Delete");
    cstmt.execute();
    catch (SQLException e) {
    throw new OAException(e.toString(), (byte)0);
    }tempvo.removeCurrentRow();
    catch (OAException e) {
    throw new OAException("No row selected", (byte)3);
    Thanks,
    Dilip

  • Passing Queries to PL/SQL procedures

    Hi,
    Is there any way in PL/SQL procedure that i can pass two Queries Texts as parameters and return the result set by taking MINUS of the rwo Query results.
    Thanx in Advace
    Shafiq

    Here is the principle...
    SQL> conn scott/tiger
    Connected.
    SQL> CREATE OR REPLACE FUNCTION qry_minus
      2     (p1 IN VARCHAR2, p2 IN VARCHAR2)
      3     RETURN sys_refcursor
      4  IS
      5     return_value sys_refcursor;
      6  BEGIN
      7     OPEN return_value FOR p1||' MINUS '||p2;
      8     RETURN return_value;
      9  END;
    10  /
    Function created.
    SQL> VAR q refcursor
    SQL> exec :q := qry_minus('SELECT deptno FROM dept', 'SELECT deptno FROM emp')
    PL/SQL procedure successfully completed.
    SQL> print q
        DEPTNO
            40
    SQL> Obviously because the query is text strings the calling program is responsible for ensuring the validity of the two queries (matching number and datatype of selected columns, etc).
    Cheers, APC

  • Passing parameters to pl/sql procedure called in portal

    Hi all,
    I am trying to use a javascript window.open function to create a small popup window that is populated by a pl/sql procedure from inside portal.
    I am trying to pass it a parameter to refine a SQL query running in that procedure, unfortunately I'm not sure of the syntax. The url that I'm trying to open in the new window looks like this:
    http://my.server.com:7777/portal/pls/portal/myschema.mypackage.myprocedure
    If I just run this, it works fine and the popup window opens correctly and displays all results. If I try to pass a parameter, it errors out with a 404 Page Not Found.
    The parameter itself comes from a text field that the user can enter a value into. I am able to get the value of that text field and append it to the url I'm generating, but I can't find the proper syntax.
    I've tried numerous syntax variants, but none of them seem to work. The procedure does have the parameter defined in both the spec and body and properly handles it. Can anyone point me in the right direction?
    Thanks,
    -Mike Markiw

    You said you have a text field where a user enters a value, so I am assuming that you have form...
    you can try following
    <form action="/pls/portal/myschema.mypackage.myprocedure" method="post">
    your text field "inVar"
    your submit button
    </form>
    I am sure your myprocedure has inVar as an input...
    If you just want to pass a value to a procedure you can always do following:
    http://my.server.com:7777/portal/pls/portal/myschema.mypackage.myprocedure?inVar=the value

  • Get the report list in a PL/SQL procedure

    Hi to all,
    I need to get the list of the personal report of a specified user in a PL/SQL procedure, is this possible?
    My procedure should delete not "standard" report of a specified portal user.
    Then i must have the list of all user's reports and after do my delete logic.
    Jhon Dhon

    Jhon -
    It sounds to me that what you want to do is have a list that is generated based upon the identification of an individual. You can do this a number of ways, but I think you would want to write a straight query to accomplish this rather than a PL/SQL procedure. A query to accomplish what you're looking to do would look something like this:
    SELECT
    person_name,
    person_id_number,
    other info you need to see in the output
    FROM
    table_name (that contains the info you need to see)
    WHERE
    conditional clauses to obtain only data you wish to see
    AND :p_person_id = table_name.person_id_number
    The AND clause line will return the employee the user wishes to see based upon that person's ID number. This information is asked for in a parameter form before the report is run. The :p_person_id is referred to as a bind variable. You can read more about this on Metalink or OTN.
    HTH,
    Steve

  • Producing text file from PL/SQL procedure (UTL_FILE)?

    Hi,
    I need to produce a text file from a PL/SQL procedure. My output should be a little over 38K records and my query has 70 fields. I'd like to separate the fields by pipe delimiters in the text file. I can either concatenate all 70 fields into one variable for each record or send all 70 fields over with a pipe, whichever is easier. It looks like I can't spool within PL/SQL but UTL_FILE might be an option from what I'm reading. Does anyone have any good, simple example(s) to produce a text file using this package in calling multiple fields from a LOOP? Our os is UNIX and db is Oracle 9i.
    Also, I've read that UTL_FILE has a record output of 1,023 bytes. Is this for each record line or the whole file size? I belive the max # of characters for each line wouldn't exceed 500 characters. The 38K rows I have for the data set would be well over 1MB. If this is the case, is there a work around to produce a larger text file?
    Any suggestions and/or examples would be greatly appreciated.
    Thanks,
    Eric

    Assuming the goal is to create a text file on the database server, you can use UTL_FILE here. Each line can be 1023 characters, but you can have as many lines as you'd like.
    Tom Kyte has an example here
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:235814350980
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • XML Data from PL/SQL procedure -- special character issue (eBS)

    Hi All,
    I am developing a report, where the XML data is created by a PL/SQL procedure. I chose this approach over a data template, since there is a lot of processing involved in producing the actual data, and it cannot be done by select-statements alone. The report is run as a regular concurrent request.
    So far so good. There is a problem though. Every time the data contains special characters (ä, ö, umlauts), the concurrent request is completed with a warning, the log confirms that "One or more post-processing actions failed.", also there is no output file. The XML structure is valid as such. The report runs smoothly and produces the output when the XML data does not contain special characters.
    I am producing the XML lines by using the standard FND_FILE.PUT_LINE procedure: Fnd_File.put_line(Fnd_File.output, '<?xml version="1.0" encoding="UTF-8"?>'); This seems like a character encoding issue, but declaring the UTF-8 encoding in this way does not solve the problem.
    Any ideas what can be done to fix this? I have been searching Metalink but cannot find an answer. Many thanks for your kind help.
    Best Regards, Matilda

    Hi Rajesh,
    One idea I have, is that it might be possible to modify the PL/SQL code into a "before report" type trigger, attached to a data template. The code would process the data and write the lines into a temporary table, from which the data template could retrieve them in a simple select-query. However, it would be neat to be able to solve this without adding an extra layer of processing, since BI Publisher supposedly supports PL/SQL procedures as the data source.
    The data in this case is all correct, special characters are an intrinsic feature of the Finnish language. :)
    Best Regards, Matilda

  • How to pass values to select clause in PL/SQL procedure

    Am relatively new to PL/SQL programming and ran into the following issue...
    Table
    EMP_MASTER
    ID VARCHAR2(10);
    FIRSTNAME VARCHAR2(20);
    DATA FOR EMP_MASTER
    '1','SCOTT'
    '2','TIGER'
    I ran the following SQL Query
    SELECT COUNT(*) FROM EMP_MASTER WHERE FIRSTNAME IN ('SCOTT','TIGER');
    This select Query is working fine and we get the count = 2 as
    expected. Now I want a procedure for the same fn()
    CREATE OR REPLACE PROCEDURE TEST_EMP_MASTER(NAMELIST IN VARCHAR2)
    IS
    CNT NUMBER := 0;
    BEGIN
    SELECT COUNT(*) INTO CNT FROM EMP_MASTER WHERE FIRSTNAME IN (NAMELIST);
    DBMS_OUTPUT.PUT_LINE('Output-->NAMELIST:'||NAMELIST||':cnt:'||cnt);
    END;
    Now when I test the procedure by passing just one value its working
    fine. But when I want to pass multiple values, it doesnt work!
    set serveroutput on;
    i.e exec TEST_EMP_MASTER('SCOTT'); Works and the output is
    Output--->NAMELIST:SCOTT:cnt:1
    but don't get the expected output for exec TEST_EMP_MASTER('SCOTT,TIGER');
    I understand that the IN modifier in the WHERE clause expects the
    values as 'Value1','value2'....I tried different combination by the
    passing the values with quotes '''value1'',''value2'''.....but no
    success

    Select  e.*
    From EMP_MASTER e;
            ID     FIRSTNAME
    1     1     SCOTT
    2     2     TIGER
    3     3     CAT
    4     4     MOUSE
    SQL> create or replace procedure count_emp_master (p_namelist VARCHAR2)
      2  AS
      3     v_namelist   VARCHAR2 (1000) := p_namelist;
      4     v_name Varchar2(100);
      5     v_count Number := 0;
      6     p_count_emp  Number := 0;
      7  BEGIN
      8     v_namelist := ',' || v_namelist || ',';
      9 
    10     FOR cur IN 1 .. LENGTH (v_namelist) - LENGTH (REPLACE (v_namelist, ',', '')) - 1
    11     LOOP
    12        v_name := (SUBSTR (v_namelist,
    13                          INSTR (v_namelist, ',', 1, cur) + 1,
    14                          INSTR (v_namelist, ',', 1, cur + 1)
    15                          - INSTR (v_namelist, ',', 1, cur) - 1
    16                         ));
    17     Select Count(1)
    18     Into v_count
    19     From emp_master
    20     Where FIRSTNAME =  v_name;
    21 
    22     p_count_emp := p_count_emp + v_count;;
    23 
    24     END LOOP;
    25 
    26     dbms_output.put_line ('namelist --> '||p_namelist ||'p_count_emp -->'||p_count_emp);
    27  END count_emp_master;
    28  /
    Procedure created
    SQL> exec count_EMP_MASTER('SCOTT');
    namelist --> SCOTTp_count_emp -->1
    PL/SQL procedure successfully completed
    SQL> exec count_EMP_MASTER('SCOTT,TIGER');
    namelist --> SCOTT,TIGERp_count_emp -->2
    PL/SQL procedure successfully completed
    SQL> exec count_EMP_MASTER('SCOTT,TIGER,CAT');
    namelist --> SCOTT,TIGER,CATp_count_emp -->3
    PL/SQL procedure successfully completed
    SQL> exec count_EMP_MASTER('SCOTT,TIGER,CAT,MOUSE');
    namelist --> SCOTT,TIGER,CAT,MOUSEp_count_emp -->4
    PL/SQL procedure successfully completed
    SQL> Message was edited by:
    Nicloei W

Maybe you are looking for

  • Amount formating in Excel output of XML Publisher Report

    Hi, I have to display my XML output in Excel format. I want the output of amount column to be displayed in form '#,###.00' and the negatives numbers are to be displayed in parenthesis. For eg number -234.5 should be displayed as (234.50). I tried <?f

  • Cant use my app shortcuts to games any more help!!

    i received my new iphone 4 today as an upgrade to my pay monthly contract. had a few speedbumps trying to figure things out though i got there in the end. I dont have a very good reception where i live but my wireless internet has been working fine,

  • Query not synchronized

    Hi, I'm having some trouble on rendering a list where some of the row attributes have changed. The list page renders a table where the value attribute is binded to a java.util.List in a request scope backing bean. I select one of the items and send i

  • Dynamic Selection Screen Help

    Hi, I am trying to create a report screen with dynamics call.... I have a Sales Order select-option no interval and no extension then i have few Parameters below such as Customer Name, Part No, Material... Whenever i select a SO, the screen will refr

  • Adding a new Big INT column to existing table in production, which holds 700 million records will impact anything in production?

    Hi Guys, I have to add a new Big INT column to existing table in production, which holds 700 million records and would like to know the impact? I have been tolled by one of my colleagues that last time they tried adding a column to same table during