Problem in invoking the stored procedure

Hi,
I am trying to invoke a stored procedure thru java jdbc. The SP works if I execute it directly.
declare P_RECORDSET1 SYS_REFCURSOR := null;
begin
USER1.USER_DELEGATE_PKG.GET_ACCOUNTS (P_RECORDSET1,'APP',74908,null,'Y',null);
end;
In the java code, I do the following
final String sql = "{CALL USER1.USER_DELEGATE_PKG.GET_ACCOUNTS(?,?,?,?,?,?)}"
cstmt = conn.prepareCall(sql);
cstmt.registerOutParameter(1, OracleTypes.CURSOR);
cstmt.setString(2, "APP");
cstmt.setInt(3, 74908);
cstmt.setObject(4, null);
cstmt.setString(5, "Y");
cstmt.setObject(6, null);
When I execute this query, I get the Invalid SQL exception. Not really able to make out whats wrong with this query...Any clues?
Thanks

Alright, now I am able to atleast invoke the SP, but getting the error
Failed to execute GET_ACCOUNTS.Message is ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'GET_ACCOUNTS'
The procedure declaration is PROCEDURE get_accounts (
param1 OUT T_CURSOR,
param2 IN VARCHAR2,
param3 IN NUMBER,
param4 IN APP.KEY_ARRAY_T,
param5 IN VARCHAR2,
param6 IN APP.KEY_INT_ARRAY_T

Similar Messages

  • Only Restarting the Weblogic Server will invoke the Stored Procedure???

    Hi,
    I have written a stored procedure which is called using hibernate
    which is working fine when ever i restart the server(Weblogic). That is for each time, when i need to invoke the stored procedure i need to restart the server to invoke it then only the stored procedure gets invoked. Which is very expensive indeed. How to overcome this, is there any way to set in the weblogic server properties, so that i can dont have to restart the server every time when i need to invoke the Stored
    procedure. Any way please do look up the code as well in which i have called the stored procedure in Hibernate.
    public int callPopulateCertDataSP(String barCode,String containerType,String conditionValue) throws SystemException {
         log.debug("Inside the callStoredProcedure Method!!!");
         int checkValue=0;
         Session hibSession = HibernateUtils.getSession();
         Connection con=hibSession.connection();
         CallableStatement cstatement=null;
         if(con!=null){
    try {
         log.debug("Inside con object not null!!!");
              cstatement=con.prepareCall("{call p_populate_cert_data(?,?,?,?)}");
              cstatement.setString(1,barCode);
              cstatement.setString(2,containerType);
              cstatement.setString(3,conditionValue);
              cstatement.registerOutParameter(4,Types.INTEGER);
              cstatement.execute();
              checkValue=cstatement.getInt(4);
              cstatement.close();
              con.commit();
              con.close();
         }catch(SQLException e){
              log.debug("The error Message is what????"+e.getMessage());
         HibernateUtils.closeSession();
         return checkValue;          
    Expecting ur replies....
    Thanks,
    JavaCrazyLover

    No Replies as Yet!!!

  • Problem when trying the Stored Procedures in JDBC receiver side

    Hi,
    I am facing some problem when i am trying to configure a scenario in the receiver side of JDBC adpater.
    We have never got stored procedures to work as messages go in 'Delivering'   status always. It's as if control never gets back to the adapter engine after the stored procedure call is made by the JDBC adapter. Then I went to checkt in the IE where the message has successfuly sent. Then I went to check
    in AE where the message is in "Delivering" state for long time.
    So checked the Default trace File and Thread dumps.
    In Thread dumps, i found a strange thing like one thread is hanging on condition wait at the below location :
      at java/lang/StringCoding.getEncoder(StringCoding.java:331(Compiled Code))
      at java/lang/StringCoding.encode(StringCoding.java:472(Compiled Code))
      at java/lang/String.getBytes(String.java:651(Compiled Code))
      at com/sap/aii/adapter/jdbc/SAXHandler.constructResponseStream(xml2sql.java:841(Compiled Code))
      at com/sap/aii/adapter/jdbc/SAXHandler.SQLcallStmt(xml2sql.java:988)
    Can you please help me in solving this issue as it is very critical to me ?
    Thanks,
    Prakash.

    Dear Prakash,
       There are number of reasons for SAX error. May be structure is not well defined, statement is not written correctly. These following links help you to solve your issue.
         SQL Queries(JDBC sendor CC)
         Oracle DB - XI - SQL DB
         JDBC Scenerio.
    Regards,
    JP.

  • Problem in executing the stored procedure

    I am trying to execute the following procedure which is used to capture data from 4 different tables:
    The table structure is as follows with the sample data:
    AREA
    ======
    area_id area_type preferred_name
    A1 Country India
    A2 State AP
    A3 Country Finland
    A4 State Finland's State
    A5 Country USA
    T_CREATE_STAGE
    =============
    we_name we_num country_nm state_nm operator
    B1 C1 A1 A2 O1
    B1 C2 A3 A4 O1
    ASSOCIATE
    ==========
    ba_name busi_associate
    ABC O1
    XYZ O2
    The IN-Paremeters of the procedure takes the Country name & State name (Prefered Name in table AREA) Operator Name (ba_name in table ASSOCIATE), at a time at least one parameter would come as Input and that could also be a Wild Card search.
    The problem is that in the following procedure the query is taking the first match and returning it infinite times. Please suggest a suitable way to run the query in the procedure so that it returns the appropriate result.
    CREATE OR REPLACE PROCEDURE proc_new_search (
    p_recordset OUT sys_refcursor,
    countryName VARCHAR2 ,
    stateName VARCHAR2 ,
    opName VARCHAR2 ,
    fieldName VARCHAR2
    AS
    BEGIN
    DECLARE
    BEGIN
    OPEN p_recordset FOR 'select b.preferred_name,d.preferred_name,a.we_name,a.we_num,c.ba_name,'
    || 'a.fluid_type,e.preferred_name FROM T_CREATE_STAGE a, AREA b,AREA d,AREA e,ASSOCIATE c '
    || 'where (upper('''||countryName||''') IS NULL or instr(b.preferred_name, upper('''||countryName||''') ) > 0) AND a.country_nm = b.area_id AND b.area_type=''COUNTRY'' AND b.active_ind=''Y'''
    ||' AND (upper('''||opName||''') IS NULL or instr(c.ba_name,upper('''|| opName||''') ) > 0) AND a.operator = c.busi_associate'
    ||' AND (upper('''||stateName||''') IS NULL or instr(d.preferred_name,upper('''|| stateName ||''') ) > 0) AND a.province_state = d.area_id AND d.area_type=''STATE_PROVINCE'' AND d.active_ind=''Y'''
    || ' AND (upper('''||fieldName||''') IS NULL or instr(a.field, upper('''||fieldName||''' )) > 0) ';
    END;
    Thanks in advance,
    Regards,
    Priya

    OK, I have extracted the SQL from the code you posted. I notice that there are FIVE tables in the FROM clause of the SQL:
    FROM T_CREATE_STAGE a,
           AREA b,
           AREA d,
           AREA e,
           ASSOCIATE cwhereas there are only THREE join-conditions joining FOUR tables [5th table AREA e has not been joined with any of the tables]:
    /* other conditions in the WHERE clause are filters, not table joins */
           AND a.country_nm = b.area_id
           AND a.operator = c.busi_associate
           AND a.province_state = d.area_idIn order to get valid expected result from a query involving FIVE tables, at least FOUR joins are required. *[ in a query involving N tables, at least N-1 joins are required ]*. Otherwise, the result will have duplication and hence will not be valid/as-expected.
    So add a join involving AREA e table with other(s) and see if this improves the result.
    HTH

  • How to limit the response rows while invoking a stored procedure from OSB 10gR3

    Dear Experts,
    I am trying to limit the response while invoking a stored procedure from OSB via DB adapter.
    Here the stored procedure returns cursors as response. I tried using the MaxTransactionSize propertiy (which is used for polling the database option in DB adapter).
    We are investigating the ways to protect the application from response containing huge number of rows.
    Is there any way to restrict the number of rows returned in each and every cursor while invoking the stored procedure via DB adapter?
    Thanks
    Ram

    Hi James ,
    I want to know how to run stored procedure using jca adapter in OSB11g.
    I am new to stored prcoedure,will be great if you could share some example on it as above.
    Req: Single input xml will be posted on queue ,need to perform 3 DB operation (with same input):
    1.Insert operation to insert master table contents.
    2.select the primary key column value from master table for the last inserted record.
    3.Need to insert primary key column value + other fields frm same xml file to child table.
    Pls assist me on how to create a simple stored procedure and to run the same with OSB 11g.I am familiar with creation of DB adapter using Jdeveloper,we have option to perform insert and to call stored procedure here,will it be useful for this scenario?
    Edited by: Anitha R on Nov 21, 2010 9:30 PM

  • Invoking ORACLE Stored Procedure

    Hello guys,
    I have an ORACLE stored procedure which I need to invoke. I'm currently unable to invoke the stored procedure since I'm always getting the same error:
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'test.set_pickup' (structure 'STATEMENTNAME'): java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'SET_PICKUP' ORA-06550: line 1, column 7: PL/SQL: Statement
    I've faced several projects where we needed to invoke stored procedures but these were located in a DB2 or Microsoft SQL Server, and these problems never occured.
    The procedure is set to the minimum, and is now only with one input parameter. I had an input and output parameter but for narrowing the problem I've removed the output.
    The structure for the stored procedure is the one that is referred by SAP or mentioned thousand of times in this forum:
    Statement_name
    StoredProcedureName (attribute ACTION)
      TABLE
      P_TRANSACTION_ID (Attributes isInput, isOutput, type)
    For the basics I'm only filling with one statement.
    I've read some threads with a similar problem but with no response, or solved but with no suggestion on how they solved it.
    Could you please help out?
    Kind regards,
    Gonçalo Mouro Vaz

    Hi,
    Is the structure in Oracle side is of the following format?
    <StatementName>
    <storedProcedureName action=u201D EXECUTEu201D>
        <table>realStoredProcedureeName</table>
    <param1 [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</param1>
    </storedProcedureName >
      </StatementName>
    Can you paste the structure here?
    Regards
    Suraj

  • How to invoke a stored procedure from SubmitEditForm.jsp

    Instead of directly inserting or updating
    the data I would like to invoked
    the stored procedure.
    Has anybody done this?

              Sam,
              BEA provides examples that are shipped with the product under
              <beahome>\weblogic700\samples\server\src\examples\
              Look at the jsp directory for JSP examples that access a database and look at
              say the jdbc\oracle\storedprocs.java for an example of java code calling out to
              a stored procedure - - by combining one of the jsp database examples with this
              stored procedure example you should be 'good to go'
              Chuck Nelson
              DRE
              BEA Technical Support
              

  • Java web service to invoke a stored procedure in the database

    Hi
    Does anybody have a example Java web srevice to invoke a stored procedure in the database
    regards
    Edited by: hrishy on May 20, 2011 12:11 AM

    hrishy wrote:
    Thanks i have modified the title so its easy to comprehendWrite the two parts mentioned above and post if you get problems with your code.
    First write code that calls the stored procedure and test that to make sure that it works.
    Then write a simple webservice and test it out to make sure it works. The integration should be trivial after that.

  • Problem in OUT Parameter in the stored procedure

    Hi,
    I have a problem in the OUT parameter of the stored procedure under the package. I encountered the error PLS-00306. Below are the codes.
    Package
    CREATE OR REPLACE package body test as
         procedure sp_countries(rst OUT country_typ) as
         sql_stmt VARCHAR2(300);
         begin
         sql_stmt := 'SELECT * FROM countries WHERE region_id = 1';
         OPEN rst FOR sql_stmt;     
         end;
    end test;
    by the way. i declared the country_typ as this:
    TYPE country_typ IS REF CURSOR;
    Here is the code that will call this package:
    declare
    tst countries%ROWTYPE;
    begin
    test.sp_countries(tst);
    dbms_output.put_line(tst.country_name);
    end;

    Works for me. Although I had to use emp instead of your table:
    SQL> create or replace
      2  package test as
      3     TYPE country_typ IS REF CURSOR;
      4     procedure sp_countries(rst OUT country_typ);
      5  end;
      6  /
    Package created.
    SQL> CREATE OR REPLACE
      2  package body test as
      3     procedure sp_countries(rst OUT country_typ) as
      4        sql_stmt VARCHAR2(300);
      5     begin
      6        sql_stmt := 'SELECT * FROM emp WHERE deptno = 20';
      7        OPEN rst FOR sql_stmt;
      8     end;
      9  end test;
    10  /
    Package body created.
    SQL> var tcur refcursor
    SQL> exec test.sp_countries(:tcur);
    PL/SQL procedure successfully completed.
    SQL> print tcur
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
    SQL>

  • Problem in calling Oracle stored procedure from Java.

    I am trying to invoke the Oracle stored procedure from Java. The procedure does not take any parameters and does not return anything. If I call it from SQL prompt it is working perfectly. I am calling it in my program as follows.
    callable_stmt=con.prepareCall("{call pkg_name.proc_name()}");
    callable_stmt.execute();
    The problem is the control-of-flow is getting strucked in the second line I wrote. It is not giving any error also.
    Please clarify me what's wrong with my code?
    Seenu.

    And how long does the stored procedure take to run from your client machine when running it via sqlplus?

  • Error while executing the stored procedure through sender JDBC adapter

    Hi All,
    I am getting below error while executing the stored procedure through sender JDBC adapter.
    Database-level error reported by JDBC driver while executing statement 'exec SapgetNextEntity 'SalesOrder''. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor.
    what is the problem? any idea to anyone...
    regards
    Ramesh

    hi Dharamveer,
    I am not getting below statement for your reply
    Try to use Refrence Cursor it will return u reference of resultset.
    I mention SP like this
    exec SapgetNextEntity 'SalesOrder'
    SapgetNextEntity -
    > SP Name
    SalesOrder----
    > Parameter I am passing...
    regards
    Ramesh

  • Problem while using oracle stored procedure in VC

    Hi All,
    I have created JDBC system and connected my locally installed Oracle data base to the VC.  I mapped the data base user to my VC user. I tested connection and it is fine. Further I see the DB alias in Visual Composer and I can drop stored procedures to my story board. I can define parameters, but when I am executing procedures I get the error message.
    Problem: I can not execute stored procedures stored in Oracle data base. Error Message: Portal request failed. Could not execute stored procedure.
    In the stored procedure, I have used select query, that returns set of records, so that  I have used  REF CURSOR as OUT Parameter. Is REF CURSOR supported by VC?. Else, any  tricks available to solve this problem?.
    Note: Stored Procedure of Sql server is working fine in VC.
    Thanks,
    Venkatesh R

    Returning (or sending in) multiple rows directly from (or to) a stored procedure is not currently possible. I have been in contact with SAP on this subject earlier, and they suggest using a web service to do the job. I used this as a work around, calling the stored procedure from a web service. I send in VC tables to this web service, and this in turn contacts my stored procedure.
    The problem is related to the connector framework in the J2EE environment.
    I am on 7.0 sps 17
    If you use stored procedure single value parameters of type varchar, number ... then VC has no problem communicating with your procedures.
    Good luck
    Henning Strand

  • Problem accessing float in stored procedures

    I wrote a stored procedure that updates a column in a table whose datatype is of float(126). I declared a global variable in the stored procedure. The value of this variable is computed in the stored procedure and is used to update the table. My problem is an error message denoting my variable declaration to be at fault keeps on showing up even if I tried different datatypes in my declaration. I've tried RANK NUMBER, RANK NUMBER(19),
    RANK FLOAT(126) even RANK NUMBER(2,2). Can anyone help?

    Albert,
    I don't know what you mean by a "global" variable in a stored procedure. Is this a java stored procedure, or is it a PL/SQL stored procedure? If it is PL/SQL, perhaps the PL/SQL forum would be more appropriate?
    For your information, the following (PL/SQL) stored procedure works fine for me on a Oracle 9.2.0.4 database:
    create or replace procedure avi as
    fv float(126);
    begin
    fv := 1.7;
    dbms_output.put_line(to_char(fv));
    end;Perhaps you would care to provide some more information?
    [But I'm not guaranteeing that I will be able to resolve your issue, if you do.]
    What database version are you using?
    Is this a java stored procedure?
    Please post the entire error message (and stack trace?) you are getting.
    Please post the code that is causing the error. [Enough code so that I can try and reproduce your situation on my computer.]
    Good Luck,
    Avi.

  • How to invoke Oracle stored procedures in Web Intelligence Custom SQL ?

    Hi,
    Referring to some older posts, I see that there is a work around to invoke a stored procedure to return results for a Web Intelligence report. Its been posted for calling a MS SQL stored proc, whereas the mentioned method does not seem to work for an Oracle Stored Procedure.
    Steps I followed:
    a) This is the parameter I have added in the oracle.sbo file => <Parameter Name="Force SQLExecute">Procedures</Parameter>
    b) My stored procedure code is as follows:
    CREATE OR REPLACE PROCEDURE get_emp_details(var_first_name OUT VARCHAR) AS
    BEGIN
    SELECT first_name INTO var_first_name
    FROM EMP_DETAILS_VIEW
    WHERE EMPLOYEE_ID = 100;
    END;
    c) Custom SQL code I added in my Webi report:
    set nocount on;
    /* SELECT
    EMP_DETAILS_VIEW.FIRST_NAME
    FROM
    EMP_DETAILS_VIEW
    exec get_emp_details;
    On trying to validate the SQL it gives me the following error message: "The SQL query has 0 instead of 1 columns.(WIS 10810)"
    Has anyone been able to successfully call an Oracle Stored procedure using the above method ?
    Version of BO: XI R3 SP2
    Oracle version: 11gR2
    PS: I am aware that web intelligence since XI R3.1 does allow use of a dedicated Stored Procedure Universe. I would want to know if it could
    be made to run in a normal Universe(not a stored procedure Universe)
    Thanks for your time and inputs.
    Regards,
    Jez

    EXECUTE is a SQL Plus command. You can directly call SP in PL/SQL
    DECLARE
        modif number;
    BEGIN
    select data_length into modif from user_tab_columns where table_name='CONTROL' and column_name='POSITION';
    IF modif < 10 THEN
        droptable('CONTROL');
        execute immediate('CRETAE TABLE CONTROL ....';
    ...

  • How to invoke a stored procedures every hour? How to Cron ?

    Hi. I have written a stored procedure using PL/SQL and it needs to invoke every hour to reset certain value. My question is how to cron or to invoke the store procedure every hour? I'm using Oracle 9i database.
    Please advice if anyone of you had came acrossed this scenario.
    Thanks.

    As Kevin suggests, you can use cron to schedule the job, but you probably not be able to just use sqlplus on the command line. When a job is executed through cron, it nly gets the environment information that is in the global .login procedure, and nothing that is in your own .profile. In most cases, this means that that you need to call a shell script from cron, and set some environment variables. You can do this either by calling your .profile file, or by setting them explicitly.
    Another thing to consider in using cron is that the command line used to start SQL*Plus will be visible to anyone who can log on to the UNIX box. For this reason, we run all cron jobs that execute SQL using an externally identified Oracle user.
    Your minimal shell script should look something like:
    #!/usr/bin/ksh
    export ORACLE_HOME=/your/directory
    export ORACLE_SID=yoursid
    export PATH=$ORACLE_HOME/bin:$PATH
    sqlplus -s username/password @/path/sqlscript
    or alternatively
    #!/usr/bin/ksh
    . ~/.profile
    sqlplus -s / @/path/sqlscript
    Make sure that your sql script ends with an exit command to close SQL*Plus.
    John

Maybe you are looking for

  • Bluetooth headset pairing problem

      I got E71-1 (11) firmware version 210.21.006 device and i also got this bluetooth headset HBH-PV720  http://www.sonyericsson.com/cws/products/accessories/overview/hbh-pv720 And i can't pair the phone with the bluetooth headset  Does E71 support thi

  • Object selection 2

    When you send a selection to the back does it become a Master item? Some of my objects are no longer selectable. Kurt

  • Confused about the Landed Costs Allocation Account

    Hi, Im uncertain about which account to use in the landed costs module. What we are doing right now is this: We add our raw materials throught the Goods Receipt Module Debiting our inventory and Crediting the allocation account which its in the liabi

  • HELP - CAN'T START ITUNES

    Hi, I previously had iTunes running with my iPod 30 GB - something has obviously happened and everytime I try to start iTUnes, I get an error message that says "<process has already exited> has generated errors and will be closed by Windows. You must

  • No XML file attachment when using Submit by Email button

    Hello all - I'm using LiveCycle Designer 8.0 to create a simple form, and am using the Submit by Email button to return the user supplied data. When I save the form and test it with Adobe Acrobat Professional 8.1.1, the email goes through just fine,