Calling Stored Procedure - Cursor SP 16

I upgraded XI to SP16 so that I can use Cursor. I am calling the stored procedure. No errors. I do not see any data in the Cursor.
I am thinking the stored procedure is returning data but for some reason I am not able to see the result set. Can someone give me a hint as to how JDBC Adapter reads the cursor that is returned or what how I can retrieve data from the cursor?
I tested the stored procedure from a java program and everthing works fine.
Any suggestions welcome.

Hi Michael,
Please check the SAP Note <a href="https://websmp103.sap-ag.de/~form/handler?_APP=01100107900000000342&_EVENT=REDIR&_NNUM=941317&_NLANG=E">941317</a>
This is a fragment:
<i>
Oracle Database 10g 10.1.x JDBC Driver
"Invoking Oracle stored procedures from within a JDBC sender channel is not supported as Oracle does not return a ResultSet in response to the query."
Oracle Database 10g 10.2.x JDBC Driver
Invoking Oracle stored procedures from within a JDBC sender channel is only possible for Oracle DBMS versions >= 10.2.x using so-called table functions</i>
Regards,
Luis Diego.

Similar Messages

  • Need sample source code for calling stored procedure in Oracle

    Hi.
    I try to call stored procedure in oracle using JCA JDBC.
    Anybody have sample source code for that ?
    Regards, Arnold.

    Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
    I have the Procedure defined as below in the SFCS1 package body
    Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
    BEGIN
    Open O_Cursor FOR
    SELECT CompanyId, CompanyName
    FROM Company
    WHERE CompanyProvince IN ('AL','AK');
    END Company_Selection;
    In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
    At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
    DECLARE
    A SFCS1.T_Cursor;
    BEGIN
    SFCS1.Company_Selection(A);
    go_Block ('Block36');
    The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause.

  • Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)

    Hi All,
    We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
    Database is Oracle.
    *Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
    Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
    If both are equal, then
         if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
         else  if the field: 'qq' in YY table equals to "Modify"  then take the data from the view table: 'Modify_View'.
    Finally, We need to archive the selected data from the respective view table.*
    From each table, data will come differently, means with different field names.
    I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
    But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
    Is there any way other than Stored Procedure?
    How to handle Data Types as data is coming from two different tables?
    Can we create one data type for two tables?
    Is BPM required for this to collect data from two different tables?
    Can somebody guide me on how to handle this?
    Waiting eagerly for help which will be rewarded.
    Thanks and Regards,
    Jyothirmayi.

    Hi Gopal,
    Thank you for your reply.
    >Is there any way other than Stored Procedure?
    Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
    I need to select the data from different tables based on some conditions. Let me simplify that.
    Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
    How can we meet this by configuring sender adapter with ATP?
    ================================================================================================
    >How to handle Data Types as data is coming from two different tables?
    If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
    we need to take data only from one table at a time. It is not join of two tables.
    ================================================================================================
    Thanks,
    Jyothirmayi.

  • How to call stored procedure with multiple parameters in an HTML expression

    Hi, Guys:
    Can you show me an example to call stored procedure with multiple parameters in an HTML expression? I need to rewrite a procedure to display multiple pictures of one person stored in database by clicking button.
    The orginal HTML expression is :
    <img src="#OWNER#.dl_sor_image?p_offender_id=#OFFENDER_ID#" width="75" height="75">which calls a procedure as:
    procedure dl_sor_image (p_offender_id IN NUMBER)now I rewrite it as:
    PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number)could anyone tell me the format for the html expression to pass multiple parameters?
    Thanks a lot.
    Sam

    Hi:
    Thanks for your help! Your question is what I am trying hard now. Current procedure can only display one picture per person, however, I am supposed to write a new procedure which displays multiple pictures for one person. When user click a button on report, APEX should call this procedure and returns next picture of the same person. The table is SOR_image. However, I rewrite the HTML expression as follows to test to display the second image.
    <img src="#OWNER#.Sor_Display_Current_Image?p_n_Offender_id=#OFFENDER_ID#&p_n_image_Count=2" width="75" height="75"> The procedure code is complied OK as follows:
    create or replace
    PROCEDURE Sor_Display_Current_Image(p_n_Offender_id IN NUMBER, p_n_image_Count in number) AS
        v_mime_type VARCHAR2(48);
        v_length NUMBER;
        v_name VARCHAR2(2000);
        v_image BLOB;
        v_counter number:=0;
        cursor cur_All_Images_of_Offender is
          SELECT 'IMAGE/JPEG' mime_type, dbms_lob.getlength(image) as image_length, image
          FROM sor_image
          WHERE offender_id = p_n_Offender_id;
        rec_Image_of_Offender cur_All_Images_of_Offender%ROWTYPE;
    BEGIN
        open cur_All_Images_of_Offender;
        loop
          fetch cur_All_Images_of_Offender into rec_Image_of_Offender;
          v_counter:=v_counter+1;
          if (v_counter=p_n_image_Count) then
            owa_util.mime_header(nvl(rec_Image_of_Offender.mime_type, 'application/octet'), FALSE);
            htp.p('Content-length: '||rec_Image_of_Offender.image_length);
            owa_util.http_header_close;
            wpg_docload.download_file (rec_Image_of_Offender.image);
          end if;
          exit when ((cur_All_Images_of_Offender%NOTFOUND) or (v_counter>=p_n_image_Count));
        end loop;
        close cur_All_Images_of_Offender;
    END Sor_Display_Current_Image; The procedure just open a cursor to fetch the images belong to the same person, and use wpg_docload.download_file function to display the image specified. But it never works. It is strange because even I use exactly same code as before but change procedure name, Oracle APEX cannot display an image. Is this due to anything such as make file configuration in APEX?
    Thanks
    Sam

  • Calling Stored Procedure with TestStand to SQL 2000

    When I run the Stored Procedure in the query analyzer it returns the recordset fine. I am not specifying any parameters. I am Using TestStand 2.01 and SQL Server 2000. I am using the OPEN SQL STATEMENT step to call the SP. When I run the SP in TestStand I get no data returned. If I run the SQL statment in TestStand I get the data that I am requesting. Does TestStand not support stored procedures.

    Hi,
    The instructions that I posted were for TestStand 3.0. In version 3.0 you can call stored procedures with input/output paramateres and to support this functionality the data operation step support several new modes.
    TestStand 2.0.1 does not support parameters on stored procedures, but it does support calling stored procedures that do not take parameters. To be able to access the data back from the database you need to set the cursor location (in the Advanced tab of the Open SQL Statement step) to Client (http://digital.ni.com/public.nsf/websearch/0EF68BF97AB1A61F86256B8E007D70C0?OpenDocument).
    By changing the cursor to Client I was able to succesfully call a stored procedure from TestStand 2.0.1 and to read back the recordse
    t return by the database. Please let me know if you are still experiencing dificulties.
    Best regards,
    Alejandro del Castillo
    National Instruments

  • JDBC performance calling stored procedures

    Hi,
    We have an java application which makes calls to PL/SQL stored procedures. We have one 'database server' component which handles all the database interaction, and other components which connect to it using CORBA.
    The problem is that with everything running, certain queries are taking from 17 to 30 seconds to come back, but when you run the same sql from SQLPlus, you get the results back in about 2 seconds every time.
    We're using a connection pool, but this doesn't seem to be the problem, as we put in diagnostics and it takes no time at all to get a free connection.
    The time is taken up doing a getCursor() to get the result set back. We register the cursor as an output parameter, and open it from within the stored procedure.
    Anyone any suggestions?
    Thanks,
    Neil.
    null

    Hi ,
    You can call stored procedure using JPA (eclipselink API).Below is the sample code
    ReadAllQuery readAllQuery = new ReadAllQuery(Employee.class);
    call = new StoredProcedureCall();
    call.setProcedureName("Read_All_Employees");
    readAllQuery.useNamedCursorOutputAsResultSet("RESULT_CURSOR");
    readAllQuery.setCall(call);
    List employees = (List) session.executeQuery(readAllQuery);
    Regards,
    Vinay

  • Java call stored procedure with nested table type parameter?

    Hi experts!
    I need to call stored procedure that contains nested table type parameter, but I don't know how to handle it.
    The following is my pl/sql code:
    create or replace package test_package as
    type row_abc is record(
    col1 varchar2(16),
    col2 varchar2(16),
    col3 varchar2(16 )
    type matrix_abc is table of row_abc index by binary_integer;
    PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
    p_arg2 IN VARCHAR2,
    p_arg3 IN VARCHAR2,
    p_out OUT matrix_abc
    END test_package;
    create or replace package body test_package as
    PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
    p_arg2 IN VARCHAR2,
    p_arg3 IN VARCHAR2,
    p_out OUT matrix_abc
    IS
    v_sn NUMBER(8):=0 ;
    BEGIN
    LOOP
    EXIT WHEN v_sn>5 ;
    v_sn := v_sn + 1;
    p_out(v_sn).col1 := 'col1_'||to_char(v_sn)|| p_arg1 ;
    p_out(v_sn).col2 := 'col2_'||to_char(v_sn)||p_arg2 ;
    p_out(v_sn).col3 := 'col3_'||to_char(v_sn)||p_arg3 ;
    END LOOP ;
    END ;
    END test_package ;
    My java code is following, it doesn't work:
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    Connection con = DriverManager.getConnection
    ("jdbc:oracle:thin:@10.16.102.176:1540:dev", "scott", "tiger");
    con.setAutoCommit(false);
    CallableStatement ps = null;
    String sql = " begin test_package.test_matrix( ?, ? , ? , ? ); end ; ";
    ps = con.prepareCall(sql);
    ps.setString(1,"p1");
    ps.setString(2,"p2");
    ps.setString(3,"p3");
    ps.registerOutParameter(4,OracleTypes.CURSOR);
    ps.execute();
    ResultSet rset = (ResultSet) ps.getObject(1);
    error message :
    PLS-00306: wrong number or types of arguments in call to 'TEST_MATRIX'
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored
    Regards
    Louis

    Louis,
    If I'm not mistaken, record types are not allowed. However, you can use object types instead. However, they must be database types. In other words, something like:
    create or replace type ROW_ABC as object (
    col1 varchar2(16),
    col2 varchar2(16),
    col3 varchar2(16 )
    create or replace type MATRIX_ABC as table of ROW_ABC
    /Then you can use the "ARRAY" and "STRUCT" (SQL) types in your java code. If I remember correctly, I recently answered a similar question either in this forum, or at JavaRanch -- but I'm too lazy to look for it now. Do a search for the terms "ARRAY" and "STRUCT".
    For your information, there are also code samples of how to do this on the OTN Web site.
    Good Luck,
    Avi.

  • Can BI Publisher call stored procedures?

    Can BI Publisher call stored procedures,no matter how?

    Hi,Chris
    "Stored PL/SQL procedures can be called from data Templates and Oracle Reports."Really?It is a great news for me.
    Currently I am working on a poc.
    There is a problem about calling Oracle stored procedures directly thru BI EE or BI Publisher.
    Our customer has a lot of stored procedures in their previous system,they strongly hope our BI EE can call these sp directly.
    All of these sp return the result set to the cursor,then the applications operate the cursor.
    As there is no way can BI EE working with Oracle stored procedures or cursor,I am wondering whether can I call the sp from BI Publisher.
    Can BI Publisher call sp or pl/sql?Can data template using pl/sql not only pure sql statements?
    I have try write some pl/sql in data template,but it failed.It seems that the data template can only operate on some returned result sets.But sp won't.
    If sp can be called thru data template,everything will be ok for me.For I can use pl/sql to opereate the returned cursor.

  • Call stored procedure with OUT parameter

    Hello,
    I have created a short-lived process. Within this process I am using the "FOUNDATION > JDBC > Call Stored Procedure" operation to call an Oracle procedure. This procedure has 3 parameters, 2 IN and 1 OUT parameter.
    The procedure is being executed correctly. Both IN parameters receive the correct values but I am unable to get the OUT parameter's value in my process.
    Rewriting the procedure as a function gives me an ORA-01460 since one of the parameters contains XML (>32K) so this is not option...
    Has someone been able to call a stored procedure with an OUT parameter?
    Regards,
    Nico

    Object is Foundation, Execute Script
    This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    import java.sql.*;
    PreparedStatement stmt = null;
    Connection conn = null;
    ResultSet rs = null;
    try {
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
    conn = ds.getConnection();
    stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
    stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
    rs = stmt.executeQuery();
    rs.next();
    patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
    } finally {
    try {
    rs.close();
    } catch (Exception rse) {}
    try {
    stmt.close();
    } catch (Exception sse) {}
    try {
    conn.close();
    } catch (Exception cse) {}

  • Creation of DB Adaptert for calling stored procedure in MS SQL server

    Hi,
    I need to create a DB adapter to call a stored procedure in MS SQL Server.
    I have gone thru the thread MS SQL Server database connection
    It mentions that we need to use a command line utility for generating the wsdl and xsd for calling stored procedures in MS SQL server. Please provide information where to find this utility and how to use it.
    Any links to tutorials are welcome.
    Thanks !!.
    Silas.

    Command line is required for stored procedures, if you are using the basic options you don't need to worry.
    (1) Download MS SQL Server 2005 JDBC Driver from Microsoft Site. http://msdn.microsoft.com/en-us/data/aa937724.aspx
    (2) The download is self extracting exe file. Extract this into Program Files on your machine. It should create folder as "Microsoft SQL Server 2005 JDBC Driver"
    (3) In above mentioned folder search for sqljdbc.jar copy this file into JDeveloper\JDBC\lib folder.
    (4) Open JDeveloper/jdev/bin/jdev.conf file add following entry.
    AddJavaLibPath C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib
    While executing this step make sure that your JDeveloper is closed.
    (5) On command prompt go to J Developer folder and execute following command
    jdev -verbose
    This will open JDeveloper.
    (6) Now go to JDeveloper > Connections > Database Connections > New Database Connection
    (7) Select Third Party JDBC
    (8) Specify MS Sql Server User Name, password and Role.
    (9) In connection page specify following
    - Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
    - For class path browse to C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib folder, select sqljdbc.jar add it as library.
    - Specify URL as following.
    jdbc:sqlserver://SERVERNAME:1433;databaseName=MSSQLDBNAME;
    (10) Go to Test page and test it.
    cheers
    James

  • Calling Stored Procedure with OraClob as parameter IN

    I am using Visual C++ and using oo4o the ole way
    I am try to call stored procedure that have Clob as parameter in
    it seems the the OraParameters Add method don't have the ability since it can only receive variantt.
    How do I do it
    Thanks
    Yoav

    fyi
    Related to the solution/workaround posted by Luc.
    see "Do Oracle's JDBC drivers support PL/SQL tables/result sets/records/booleans? "
    at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#34_05
    regards
    Jan Vervecken

  • Calling Stored Procedure with in Stored Procedure

    I have one stored procedure A, I want to call Stored procedure A from Stored Procedure B and want to give input parameter to Stored Procedure A within Stored Procedure B using while loop.
    i.e I have one stored procedure A which uses Telephone number as input parameter and pull out data
    I want to create one more stored procedure B which will call stored procedure A internally and give telephone number one by one using while loop and push the result in Table C.

    >
    I have one stored procedure A, I want to call Stored procedure A from Stored Procedure B and want to give input parameter to Stored Procedure A within Stored Procedure B using while loop.
    i.e I have one stored procedure A which uses Telephone number as input parameter and pull out data
    I want to create one more stored procedure B which will call stored procedure A internally and give telephone number one by one using while loop and push the result in Table C.
    >
    Doesn't sound a good idea in terms of performance or design. OK, what's your query?
    The concept is:
    create or replace procedure Proc_A (p_phone varchar2)
    is
    Begin
       Insert into Tablec (col1, col2, col3, phone) values (val1, val2, val3, p_phone);
    Exception
      When no_data_found then
       do what...
    End;
    Create or Replace Procedure Proc_B as
    Begin
    For i in (select phone_no from customer)
    Loop
      Proc_A(i.phone_no);
    End Loop;
    End;
    /Once again, I have to say, it's a bad idea. You may well do it within a single procedure or even a single SQL. Tell us your exact requirements and we'll be able to help you
    Edited by: user12035575 on Sep 5, 2011 8:26 PM

  • Calling Stored Procedure without JDBC-Adapter

    Hallo,
    as it is not possible calling Stored Procedures with the parameter Typ Record in Oracle my question: It is possible connecting to DB using native java-code for example in Mapping?
    Thanks in advance,
    Frank

    Hi Frank,
    Maybe you can use the DB look up using the JDBC adapter in your mapping.
    Just check this blog for the same,
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    As for calling an Oracle Strored Procedure, it is possible using a RECEIVER JDBC adapter, but not a SENDER JDBC adapter.
    <i> import the jdbc-driver (oracle) in an archive in Designer.</i>
    Also, this imported archive should be under any Namespace, but, it should be in the same SWCV as the one in which the mapping is being executed.
    Regards,
    Bhavesh

  • CALLING STORED PROCEDURE IN DATABASE FROM FORMS4.5

    Is there any body know how to call stored procedure from Forms 4.5 ?
    I am writing a when-button-pressed trigger.
    Put the stored procedure name on there. But
    it said "stored procedure name is not declared on this scope".
    Thanks a lot
    null

    Try logging in to SQL*Plus and running the procedure, e.g....
    SQL> begin
    database_procedure_name(update_web);
    end;
    If it runs OK there, then it should run from within your form (provided that you are logged in as the same user as the test with SQL*Plus.

  • Calling stored procedure in OCCI

    Hi, Guys.
    I triy to call stored procedure in Oracle database server.But i have problems with taking of the OUT parameters.
    How to call the procedure corectly?
    Depend on Oracle manual everything is fine but as we see that is not.
    Here is the 2 lines that make the problem.
    statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
    statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
    I can't access Type::OCCIINT and Type::OCCIString.
    I tried and Type::OCCISTRING but without any result.
    Can you help me?
    This is the all code i use:
    Environment *env = Environment::createEnvironment ( Environment::DEFAULT );
    Connection *conn = env->createConnection ( user, pass, osid );
    Statement * statement = conn->createStatement ( query );
    ResultSet * result = statement->executeQuery ( query );
    result->setCharacterStreamMode ( 2, 10000 );
    statement->setSQL ( "BEGIN tracetst.get_tst_moduls ( :1, :2, :3 ); END:" );
    int if_false;
    string __result;
    statement->setString ( 1, "116714020010" );
    statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
    statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
    statement->executeUpdate();
    if_false = statement->getInt (2);
    /* Set the 1,2 args into err_result and modules. The action is only with these */
    err_result = if_false;
    __result = statement->getString (3);
    cout << if_false;
    cout << __result;
    //printf ( result );
    //statement->executeUpdate ( query );
    env->terminateConnection ( conn );
    Environment :: terminateEnvironment ( env );
    While compiling I have an error message.Here it is :
    trace.cpp: In member function `const char* oracle_io::get_data()':
    trace.cpp:668: error: `oracle::occi::Type' is not an aggregate type
    Tha is the line adn the next line is same :
    statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
    statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
    How to call the procedure corectly?
    Depend on Oracle manual everything is fine but as we see that is not.
    Thanks in advance.
    P.S. I would like to thanks to Amogh for helping me before.

    Did you remove the colon after END ?
            Environment *env = Environment::createEnvironment(Environment::OBJECT);
            Connection *conn = env->createConnection("scott","tiger","inst1");
            Statement *stmt;
            int num; string name;
            try
                    stmt=conn->createStatement();
                    stmt->setSQL ( "BEGIN scott.test ( :1, :2, :3 ); END;" );
                    stmt->setString ( 1, "11" );
                    stmt->registerOutParam(2, OCCIINT,sizeof(num));
                    stmt->registerOutParam(3, OCCISTRING,sizeof(name));
                    stmt->execute();
                    num=stmt->getInt(2); name=stmt->getString(3);
                    cout<<num<<"   "<<name<<endl;
            catch (SQLException &ex)
                    env->terminateConnection(conn);
                    Environment::terminateEnvironment(env);
                    cout<<ex.getMessage();
            env->terminateConnection(conn);
            Environment::terminateEnvironment(env);
    ...Rgds.
    Amogh

Maybe you are looking for

  • How do I use 2 network cards?

    I want to use a wireless connection and a wired connection.  Each connection is on a different subnet, so they connect OK.  Wireless connection uses 192.168.182.XXX and the wired uses 192.168.1.XXX.  Wireless is primarily for internet browsing.  Wire

  • Synaptic touchpad stops working now and then on ProBook 6450b

    The touchpad on my ProBook 6450b stops working every now and then. It just freezes, no error message or anything. It always works again after I reboot. It also starts working immediately if I go to the Task Manager and kill SynTPEnh.exe and then rest

  • Rounding up off values using Different Condition types

    Dear All, There is a requirement from the client where they want to round up the values in all the condition type values.For Example: ZPR0-           1525 ZCOM(15%)-  228.75(It Should be 229.00) NBT(Tax2%)   25.93(It Should be 26) Similarly all the v

  • FIRST_VALUE & LAST_VALUE

    Given the following sample data: AverageRate CurrencyDate 1.0001            2001-09-03 1.0001            2001-09-04 1.0002            2001-09-05 1.0002            2001-09-06 1.0005            2001-09-07 1.0005            2001-09-08 1.0005           

  • I can't download in-App

    Why !?