Errors in calling Oracle stored procedure using java CallableStatement

Hello,
I have an oracle stored procedure below, it has been tested in PL/SQL without errors. During testing, in_c_file_type="F"; out_n_seqno_freeformat=120139596 and out_n_seqno_commaseprated is null (empty in value column).
When I run the program in Eclipse (windows xp), error messages is below: (It stopped at line 'cstme.execute();' )
Message:ORA-06550: line 1, column 26: PLS-00103: Encountered the symbol "" when expecting one of the following:   . ( ) , * @ % & | = - + < / > at in is mod remainder not   range rem => .. <an exponent (**)> <> or != or ~= >= <= <>   and or like LIKE2_ LIKE4_ LIKEC_ as between from using ||   indicator multiset member SUBMULTISET_ The symbol ", was inserted before "" to continue. Error code:6550 SQL statement:65000 {code} Does anyone know what cause the error? It seems like something is missing in the stored procedure. But the stored procedure passes the test in the PL/SQL. The oracla driver I used is Oracle thin driver. Oracle version is 10.2.g Thanks in advance. northcloud {code} create or replace procedure SP_GET_SEQNO_2( in_c_file_type in char, out_n_seqno_freeformat out integer, out_n_seqno_commaseprated out integer) is n_seqno_commaseprated    integer; n_seqno_freeformat        integer; begin if in_c_file_type ='F' THEN  SELECT message_counter.nextval INTO n_seqno_freeformat FROM dual; insert into temp_stroperations (record_id,OUTPUT_STR,INPROCESS_STR) values (n_seqno_freeformat,empty_clob(),empty_clob()); elsif in_c_file_type ='C' THEN  SELECT message_counter.nextval INTO n_seqno_commaseprated FROM dual; insert into temp_stroperations (record_id,OUTPUT_STR,INPROCESS_STR) values (n_seqno_commaseprated,empty_clob(),empty_clob()); else SELECT message_counter.nextval INTO n_seqno_freeformat FROM dual; insert into temp_stroperations (record_id,OUTPUT_STR,INPROCESS_STR) values (n_seqno_freeformat,empty_clob(),empty_clob()); SELECT message_counter.nextval INTO n_seqno_commaseprated FROM dual; insert into temp_stroperations (record_id,OUTPUT_STR,INPROCESS_STR) values (n_seqno_commaseprated,empty_clob(),empty_clob()); end if; out_n_seqno_freeformat        := n_seqno_freeformat; out_n_seqno_commaseprated    := n_seqno_commaseprated; end SP_GET_SEQNO_2; {code} ----- A part of java code I used to call the stored procedure is here. {code} String escapeString = "{call SP_GET_SEQNO_2 (? ? ?)}"; CallableStatement cstme = null; try { cstme = con.prepareCall(escapeString); cstme.setString(1, "F"); cstme.registerOutParameter(2, java.sql.Types.INTEGER); cstme.registerOutParameter(3, java.sql.Types.INTEGER); cstme.execute(); int seqNoFreeformat=0, seqNocommasepreted=0; seqNoFreeformat = cstme.getInt(2); seqNocommasepreted = cstme.getInt(3); System.out.println ("In ConvertXML.processStoredProcedure(), seqNoFreeformat= "+seqNoFreeformat+";seqNocommasepreted="+seqNocommasepreted); } catch (SQLException e) { //System.out.println ("In ConvertXML.processStoredProcedure(), SQLException: "+e); System.err.println("Message:"+e.getMessage()); System.err.println("Error code:"+e.getErrorCode()); System.err.println("SQL statement:"+e.getSQLState()); log.log(Level.INFO, log.getName() + " - SQLException : "+e); } {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

es5f2000 wrote:
jschell wrote:
That works?I dunno. The below definitely works, but like I said, I've only
ever done it with one output parameter (and that has always
been a ResultSet).
String callableQuery = "{?= call my_package.my_call(?, ?)}"
Yes I have done that and at least in terms of my code it wasn't just a result set.
But not with two.

Similar Messages

  • PLS-00306:NET to call Oracle stored procedure,Use Array parameters

    Development Environment:Windows 2003 SP2+Oracle 10g
    . NET to call Oracle stored procedure, use an array of types of parameters
    Step1:(In the Oracle database define an array of types)
    CREATE OR REPLACE TYPE STRING_VARRAY AS VARRAY (1000) OF NVARCHAR2(255)
    OR
    CREATE OR REPLACE type string_array is table of nvarchar2(255)
    Step2:
    CREATE OR REPLACE PROCEDURE Test
    (i_test in string_varray,o_result out int)
    IS
    BEGIN
    o_result:=i_test.count;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    WHEN OTHERS
    THEN
    o_result:=0;
    END arraytest;
    Step3:
    ODP.NET(Oracle 10g)
    OracleConnection conn = new OracleConnection("User Id=test;Password=test;Data Source=test");
    OracleCommand cmd = new OracleCommand("Test", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    string[] str = new string[2] { "11", "222" };
    cmd.ArrayBindCount=2;
    OracleParameter p1 = new OracleParameter("i_test", OracleDbType.NVarChar);
    p1.Direction = ParameterDirection.Input;
    p1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p1.Value = str;
    p1.ArrayBindSize=new int[2]{2,3};
    p1.ArrayBindStatus = new OracleParameterStatus[2]{
    OracleParameterStatus.Success,
    OracleParameterStatus.Success
    cmd.Parameters.Add(p1);
    OracleParameter p2 = new OracleParameter("o_result", OracleDbType.Int32);
    p2.Direction = ParameterDirection.Output;
    P2.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p2.Value=0;
    cmd.Parameters.Add(p2);
    int i = 0;
    try
    conn.Open();
    cmd.ExecuteNonQuery();
    i =(int) p2.Value;
    catch (Exception ex)
    finally
    conn.Close();
    Error:
    Execution Failed:ORA-06550:Line 1,Column 7:
    PLS-00306:Test parameters when calling the number or types of errors
    ORA-06550:Line 1,Column 7:
    PL/SQL:Statement ignored

    Hi,
    See the answer in [this thread|http://forums.oracle.com/forums/thread.jspa?threadID=909564&tstart=0]
    Hope it helps,
    Greg

  • . NET to call Oracle stored procedure, use an array of types of parameters

    . NET to call Oracle stored procedure, use an array of types of parameters
    Step1:(In the Oracle database define an array of types)
    CREATE OR REPLACE TYPE STRING_VARRAY AS VARRAY (1000) OF NVARCHAR2(255)
    Step2:
    CREATE OR REPLACE PROCEDURE Test
    (i_test in string_varray,o_result out int)
    IS
    BEGIN
    o_result:=i_test.count;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    WHEN OTHERS
    THEN
    o_result:=0;
    END arraytest;
    Step3:
    Use System.Data.OracleClient
    C# Code:
    OracleConnection conn = new OracleConnection("User Id=test;Password=test;Data Source=test");
    OracleCommand cmd = new OracleCommand("Test", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    string[] str = new string[] { "11", "22" };
    OracleParameter p1 = new OracleParameter("i_test", OracleType.NVarChar);
    p1.Direction = ParameterDirection.Input;
    p1.Value = str;
    cmd.Parameters.Add(p1);
    OracleParameter p2 = new OracleParameter("o_result", OracleType.Int32);
    p2.Direction = ParameterDirection.Output;
    cmd.Parameters.Add(p2);
    int i = 0;
    try
    conn.Open();
    cmd.ExecuteNonQuery();
    i =(int) p2.Value;
    catch (Exception ex)
    finally
    conn.Close();
    Error:
    Execution Failed:ORA-06550:Line 1,Column 7:
    PLS-00306:Test parameters when calling the number or types of errors
    ORA-06550:Line 1,Column 7:
    PL/SQL:Statement ignored
    Edited by: user10133982 on Jun 4, 2009 7:13 AM

    . NET to call Oracle stored procedure, use an array of types of parameters
    The use of ODP.net(Oracle 10g), the error is still the same
    Step1:(In the Oracle database define an array of types)
    CREATE OR REPLACE TYPE STRING_VARRAY AS VARRAY (1000) OF NVARCHAR2(255)
    Step2:
    CREATE OR REPLACE PROCEDURE Test
    (i_test in string_varray,o_result out int)
    IS
    BEGIN
    o_result:=i_test.count;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    NULL;
    WHEN OTHERS
    THEN
    o_result:=0;
    END arraytest;
    Step3:
    ODP.NET(Oracle 10g)
    OracleConnection conn = new OracleConnection("User Id=test;Password=test;Data Source=test");
    OracleCommand cmd = new OracleCommand("Test", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    string[] str = new string[2] { "11", "222" };
    cmd.ArrayBindCount=2;
    OracleParameter p1 = new OracleParameter("i_test", OracleDbType.NVarChar);
    p1.Direction = ParameterDirection.Input;
    p1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p1.Value = str;
    p1.ArrayBindSize=new int[2]{2,3};
    p1.ArrayBindStatus = new OracleParameterStatus[2]{
    OracleParameterStatus.Success,
    OracleParameterStatus.Success
    cmd.Parameters.Add(p1);
    OracleParameter p2 = new OracleParameter("o_result", OracleDbType.Int32);
    p2.Direction = ParameterDirection.Output;
    P2.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
    p2.Value=0;
    cmd.Parameters.Add(p2);
    int i = 0;
    try
    conn.Open();
    cmd.ExecuteNonQuery();
    i =(int) p2.Value;
    catch (Exception ex)
    finally
    conn.Close();
    Error:
    Execution Failed:ORA-06550:Line 1,Column 7:
    PLS-00306:Test parameters when calling the number or types of errors
    ORA-06550:Line 1,Column 7:
    PL/SQL:Statement ignored
    Edited by: user10133982 on Jun 5, 2009 7:48 AM

  • 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 calling a stored procedure using SQLJ

    I am calling a stored procedure defined inside a package through a SQLJ script. The first parameter of that procedure is a IN OUT parameter which is used as a ROWID for creating a cursor. That ROWID value is the same for every record in the table, thereby enabling us to create a cursor.
    When I give a hard-coded value as a parameter, I get an error stating that the assignment is not correct as the query is expecting a variable and not a literal. Hence I removed the hard-coded value and included a dymanic value in the SQLJ call.
    String strVal = "A";
    #sql{CALL ASSIGNMENTS_PKG.INSERT_ROW :{strVal},'SALARY_CODE_GROUP','BU',3,105,sysdate,1,sysdate,1,1)};
    Here "ASSIGNMENTS_PKG" is a package name and INSERT_ROW is the procedure.
    When the SQLJ program is run, I get an error stating:
    "PLS-00201: identifier 'A' must be declared"
    I read the error message, but I am not able to understand where I need to give the GRANT permission to.

    If you're using Oracle Provider for OLE DB (OraOLEDB) to execute this stored procedure, you need to set PLSQLRSet attribute. This attribute can be set in registry, connection string, or command object. Please refer to User Documentation for more information.

  • Calling Oracle stored procedure from java

    The following query calls a stored procedure TRANSLATE_ZONEPATH_ID defined in a package MT by the user MTDBA. currentZone is a member variable of the class, and currently has value 1
    This query works just fine when I run it from SQLPlus* connected as MTDBA.
    But from java, the following piece throws exception saying "invalid column name"
    String query = "SELECT MTDBA.MT.TRANSLATE_ZONEPATH_ID('"+currentZone+"') "
    + "FROM DUAL ";
    try
    Statement stmt = conn.createStatement();
    ResultSet rst = stmt.executeQuery(query);
    if (rst.next())
    fullName = rst.getString(1);
    stmt.close();
    Anyone got any clue ?

    I always use CallableStatement to execute a stored procedure or function in a database (Oracle).
    try this:
    <code>
    CallableStatement cs = dbConnection.prepareCall("{ ? =
    MTDBA.MT.TRANSLATE_ZONEPATH_ID(?)}");
    cs.setString(1, currentZone);
    cs.registerOutParameter(1, Types.VARCHAR);
    cs.executeUpdate();
    fullname = cs.getString(1);
    cs.close();
    </code>
    There is also a jdbc forum, where your should post this kind of problem :-)
    Hope this help's
    ThK

  • How to call Oracle Stored Procedure using EDQ

    Can someone tell me how to use Oracle Stored Procedure call in EDQ, sample scripts/steps will be really helpful. Thanks!

    It is also possible to do this using a custom processor in EDQ. The processor needs to do something very similar to the external task above (opens a DB connection, authenticates, runs a stored procedure).
    If you need this, please talk us through the use case so we can determine if it is the best fit. In some ways, an external task is better as logically a stored procedure call is normally divorced from any process logic in EDQ.
    Regards,
    Mike

  • Getting error while Calling Oracle Stored Procedure with output Parameter

    HI All,
    From long days i am working on this but i unable to solve it.
    Even i have studied so many forums in SAP but i didn't find the solution.
    I am calling Oracle Store procedure with 3 inputs and 1 output without cursor.
    Store Procedure:-
    CREATE OR REPLACE PROCEDURE PDS.send_rm
    IS
    proc_name           VARCHAR2(64) := 'send_rm';
    destination_system  VARCHAR2(32) := 'RAWMAT';
    xml_message         VARCHAR2(4000);
    status_code         INTEGER;
    status_message      VARCHAR2(128);
    debug_message       VARCHAR2(128);
    p_ret               INTEGER;
    BEGIN
      DBMS_OUTPUT.PUT_LINE( proc_name || ' started' );
      xml_message := '<RAW_MATERIAL>'||
                     '<BAR_CODE>10000764601</BAR_CODE>'||
                     '<MATERIAL>1101448</MATERIAL>'||
                     '<VENDOR_CODE/>'||
                     '<PRODUCTION_DATE>0000-00-00</PRODUCTION_DATE>'||
                     '<EXPIRE_DATE>0000-00-00</EXPIRE_DATE>'||
                     '<BATCH/>'||
                     '<PO_NUM/>'||
                     '<MATERIAL_DESCRIPTION>POWER SUPPLY</MATERIAL_DESCRIPTION>'||
                     '<SPEC_NAME/>'||
                     '<STOCK_CODE>BSW-JH</STOCK_CODE>'||
                     '<INSPECTION_LOT>00</INSPECTION_LOT>'||
                     '<USAGE_DECISION_CODE/>'||
                     '<MATERIAL_GROUP>031</MATERIAL_GROUP>'||
                     '</RAW_MATERIAL>';
          dbms_output.put_line('XML '||xml_message);
    --      vp_interface.load_rawmat@cnprpt1_pds(SYSDATE, destination_system,
    --                   xml_message, p_ret);
          vp_interface.load_rawmat(SYSDATE, destination_system,
                       xml_message, p_ret);
          dbms_output.put_line('Return Code '||p_ret);
          COMMIT;
    EXCEPTION
      WHEN OTHERS THEN
        status_code := SQLCODE;
        status_message := SUBSTR(SQLERRM, 1, 64);
    --    Extract_Error_Logger(proc_name, 'LOCAL', SYSDATE, -999,
    --                         status_message, 0, debug_message);
        ROLLBACK;
    END send_rm;
    And while i am calling this Store procedure in MII, I am facing error.
    I have tried different ways but didnt solved
    In SQL Query, i kept mode as: FixedQueryOutput
    Can anyone tell me or send code for calling above store procedure
    And onemore thing, While creating store procedure in Oracle for MII. Do we need to Create output parameter as cursor or normal.  
    Thanks,
    Kind Regards,
    Praveen Reddy M

    Hi Praveen
    Our wrapper was created because we could not modify the procedure we call (it was not returning a cursor).
    CREATE OR REPLACE PROCEDURE CHECK_PUT_IN_USE
    (STRCMPNAME in varchar2,
    STRSCANLABEL in varchar2,
    RCT1 out SYS_REFCURSOR
    AS
      charDispo          Char(1);
      charStatus          Char(1);
      intCatNo          Integer;
      charCatDispo     Char(1);
      strCatQual          VarChar2(2);
      strCatDesc          VarChar2(30);
      strMsg          VarChar2(128);
    BEGIN
    qa.check_put_in_use@AR(STRCMPNAME,
                                              STRSCANLABEL,
                                              charDispo,
                                              charStatus,
                                              intCatNo,
                                              charCatDispo,
                                              strCatQual,
                                              strCatDesc,
                                              strMsg);
    OPEN RCT1
    FOR Select charDispo,charStatus,charDispo,charStatus,intCatNo,charCatDispo,strCatQual,strCatDesc,strMsg from Dual;
    END;
    Hope this helps
    Regards
    Amrik
    then with a FixedQueryWithOutput
    call mixar.qasap.wrapper_update_put_in_use('[Param.1]','[Param.2]',[Param.3],?)
    Hope this helps.

  • Problem Calling Oracle Stored Procedure From JAVA

    Hello all. I've been banging my head against this all day:
    Here's the procedure I'm calling:
    GetIDsByLatLonRadius(inLatitude IN NUMBER,
    inLongitude IN NUMBER,
    inRadius IN NUMBER,
    inTableName IN VARCHAR2,
    inIDColName IN VARCHAR2,
    inLatColName IN VARCHAR2,
    inLonColName IN VARCHAR2,
    LocationIDs OUT HomesCom_Types.GenericCursorType,
    ErrorNo OUT VARCHAR2);
    And here's the JAVA code:
    public Hashtable GetInRadius(Hashtable inStruct)
    ResultSet locationIDs = null;
    Hashtable outputHash = new Hashtable();
    float latitude = (float) 30.429;
    float longitude = (float) -84.2585;
    float radius = (float) 10;
    try {
    CallableStatement proc = con.prepareCall("{ call GEOCODING.getidsbylatlonradius(?,?,?,?,?,?,?,?,?) }");
    proc.setFloat(1,latitude);
    proc.setFloat(2,longitude);
    proc.setFloat(3,radius);
    proc.setString(4,"demographics_school");
    proc.setString(5,"onboard_id");
    proc.setString(6,"geocoding_latitude");
    proc.setString(7,"geocoding_longitude");
    proc.registerOutParameter(8,OracleTypes.CURSOR);
    proc.registerOutParameter(9,OracleTypes.VARCHAR);
    proc.execute();
    locationIDs = (ResultSet) proc.getObject(1);
    if (locationIDs != null)
    outputHash.put("query",locationIDs);
    else
    outputHash.put("query","LOCATION ID WAS NULL");
    catch(SQLException sqlException) {  
    System.out.println(
    "The following error occured in reading " +
    "from the table: "
    + sqlException);
    outputHash.put("error",sqlException.getMessage());
    return outputHash;
    This catches and the sqlException I get is: Unhandled sql type
    I'm not a java expert and I'm completely stuck at this point, so I figured a few more eyes on it might help.
    Thanks in advance,
    Danny

    Danny,
    Don't print merely the error message, print the whole stack trace.
    Then post it here.
    What java version are you using?
    What JDBC driver and version are you using?
    What Oracle database version are you using?
    Is the code from a Java ServerPages (JSP) or from a Java Stored Procedure (JSP)?
    I guess "HomesCom_Types" is one of your PL/SQL packages or routines, right?
    If so, then you can't use it in JDBC, you must define a database type using the command:
    create or replace type ...But in later versions of the Oracle database, the REF CURSOR type is built-in.
    Check the Oracle documentation for more details.
    Good Luck,
    Avi.

  • How to call oracle stored procedure

    how to call oracle stored procedure using
    jdevloper.can any one help?
    thanks
    pullareddy

    Connection conn =
    DriverManager.getConnection("your connect string");
    CallableStatement stm=conn.prepareCall( "{?=call getDeptName(?)}");
    stm.registerOutParameter(1,OracleTypes.VARCHAR);
    int deptno=10;
    stm.setInt(2,deptno);
    stm.execute();
    String dname=stm.getString(1);
    stm.close();
    conn.close();
    getDeptName is a function:
    FUNCTION
    getDeptName(id IN NUMBER) RETURN VARCHAR2...

  • How to call a stored procedure using its package name in Oracle

    hi
    we're doing a JDBC scenario where we call a stored procedure(a.prc) using its package name(b)The stored procedure has In /Out/IN-OUT parameter.
    i have got 2 queries:
    1- How to call the stored procedure using it's package.
    2- How to capture the In/Out parameter in the response.

    hi Prateek
    thanks for the reply.
    However when i tried mapping it to Package.procedure, communication channel throws the error saying that Package.proceudre needs to be declared.
    As i said , the procedure has IN-OUT parameter too.In oracle we need to write a block if we want to read the IN-OUT parameter.
    How to get the IN-OUT parameter in XI?

  • Calling packaged stored procedure from Java

    Hi All,
    I'm trying to call a stored procedure from Java but I'm having
    problems with registrating the output parameter. I'm getting
    the error: Conflicting parameters.: sqltype=2003
    This is the stored procedure which is located in a package in
    the Oracle database:
    package Pack_GetAgencyInformation as
    Type InfoType is record ( agen_code varchar(3), agen_designation
    varchar(30), agen_adresse varchar(60), agen_tel varchar(12) );
    function GetAgencyInformation( P_AGENCE VARCHAR )
    return Pack_GetAgencyInformation.InfoType
    end Pack_GetAgencyInformation;
    This is the Java source from where I'm calling the procedure:
    //DriverManager.registerDriver (new
    oracle.jdbc.driver.OracleDriver());
         Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@164.48.69.125:1521:ventes", "system", "*****
    // @machineName:port:SID,
    userid, password
    CallableStatement cs = conn.prepareCall("{ ? = call
    Pack_GetAgencyInformation.GetAgencyInformation( ? )}");
         try {
              cs.registerOutParameter( 1,
    oracle.jdbc.driver.OracleTypes.ARRAY);
         } catch (SQLException e) {
              e.printStackTrace();
         cs.setString(2, "001" );
         //ResultSet rset = cs.executeQuery();
    The stacktrace:
    java.sql.SQLException: Parametertypen conflicteren.:
    sqlType=2003
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:210)
    at
    oracle.jdbc.driver.OracleCallableStatement.registerOutParameter
    (OracleCallableStatement.java:220)
    at
    oracle.jdbc.driver.OracleCallableStatement.registerOutParameter
    (OracleCallableStatement.java:350)
    at dbAccess.main(dbAccess.java:25)
    I think it has to do with the type InfoType which is created in
    the Stored Procedure. I'm absolute no Oracle expert and I
    prefer not to make changes to the Oracle database. So any
    solution in Java is welcome!
    BR, H.Rietman

    I managed to get it to work only by changing the stored
    procedure. I have changed the return type record to a Ref
    Cursor type (had to change alot of code for this). It seams
    that Oracle JDBC drivers DON'T support the Record type as a
    return type.
    So the next question is: is it possible to typecast a record
    type to a ref cursor type in Oracle. In this way I can easily
    change the return type for the stored procedures.
    /Harald

  • Passing data from Oracle stored procedures to Java

    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.

    user1754151 wrote:
    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.If logic is already written in DB, and the only concern is of passing the result to java service side, and also from point of maintenance problem and flexibility i would suggest to use the sys_refcursor.
    The reason if Down the line any thing changes then you only need to change the arguments of sys_refcursor in DB and as well as java side, and it is much easier and less efforts compare to using and changes required for Types and Objects on DB and java side.
    The design and best practise keeps changing based on our requirement and exisiting design. But by looking at your current senario and design, i personally suggest to go with sys_refcursor.

  • Problem in writting oracle stored procedure in java

    Hi,
    Can anybody please suggest me how can I access oracle stored procedure in Java.
    Thanks

    please find the examples in the below url.
    http://javaalmanac.com/egs/java.sql/pkg.html

  • Calling an Oracle stored procedure using Toplink API - Please help

    Hi,
    We are evaluating Toplink as a possible data access layer in large service-oriented application. The ability to call db stored procedures from within business object layer is crucial for our architechture.
    I am trying to follow toplink application developer's guide examples on how to call stored procedures using toplink.
    I have the folling java code:
    call.setProcedureName("PR_ROMAN_TEST");
    call.addNamedArgument("IN_PARAM");
    call.addNamedOutputArgument("OUT_PARAM");
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    query.addArgument("IN_PARAM");
    Vector params = new Vector();
    params.addElement(new Integer(5));
    Number result = (Number) session.executeQuery(query, params);
    This generates the following SQL statement:
    BEGIN PR_ROMAN_TEST(IN_PARAM=>5, OUT_PARAM=>?); END;
    An attempt to execute it causes a
    java.sql.SQLException: Invalid column index.
    As I understand it, this exception is thrown because of the "?" in place of the out-parameter value holder.
    The SQL statement that I would want toplink to generate and execute should look like:
    DECLARE result number; BEGIN PR_ROMAN_TEST(IN_PARAM=>5, OUT_PARAM=>result); END;
    , but how do I achieve it and how do I capture the return value, all using toplink api?
    Please help
    Thank you in advance,
    Roman

    I read the conversation above. I am running into a similar kind of problem. I get the following error.
    <an exponent (**)> <> or != or ~= >= <= <> and or like between || The symbol "." was subs Error Code: 6550Local Exception Stack: Exception [TOPLINK-4002] (OracleAS TopLink - 10g (9.0.4.5) (Build 040930)): oracle.toplink.exceptions.DatabaseException Exception Description: java.sql.SQLException: ORA-06550: line 1, column 38: PLS-00103: Encountered the symbol "NAME" when expecting one of the following:. ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like as between from using || The symbol "." was substituted for "NAME" to continue.ORA-06550: line 1, column 55: PLS-00103: Encountered the symbol "ID" when expecting one of the following:. ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like between || The symbol "." was subs Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 38:PLS-00103: Encountered the symbol "NAME" when expecting one of the following . ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like as between from using || The symbol "." was substituted for "NAME" to continue.ORA-06550: line 1, column 55:PLS-00103: Encountered the symbol "ID" when expecting one of the following: . ( ) , * @ % &' | = - + < / > at in is mod not range rem =>.. <an exponent (**)> <> or != or ~= >= <= <> and or like between || The symbol "." was subs Error Code: 6550 at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:227)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:733)
    at oracle.toplink.internal.databaseaccess.DatabasePlatform.executeStoredProcedureCall(DatabasePlatform.java:1605)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:649)
    at oracle.toplink.threetier.ServerSession.executeCall(ServerSession.java:506)at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:131)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeCall(CallQueryMechanism.java:115)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelectCall(CallQueryMechanism.java:194)
    at oracle.toplink.internal.queryframework.CallQueryMechanism.executeSelect(CallQueryMechanism.java:175)
    at oracle.toplink.queryframework.DirectReadQuery.executeNonCursor(DirectReadQuery.java:65)
    at oracle.toplink.queryframework.DataReadQuery.execute(DataReadQuery.java:73)
    at oracle.toplink.queryframework.ValueReadQuery.execute(ValueReadQuery.java:59)
    at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:493)
    at oracle.toplink.queryframework.ReadQuery.execute(ReadQuery.java:125)
    at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:1958)
    at oracle.toplink.threetier.ServerSession.internalExecuteQuery(ServerSession.java:629)
    at oracle.toplink.threetier.ClientSession.internalExecuteQuery(ClientSession.java:392)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086)
    at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(UnitOfWork.java:2246)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1086)
    at oracle.toplink.publicinterface.Session.executeQuery(Session.java:1055)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate$2.readFromSession(TopLinkTemplate.java:181)
    at com.eplinc.common.persistence.toplink.SessionReadCallback.doInTopLink(SessionReadCallback.java:59)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate.execute(TopLinkTemplate.java:110)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate.executeQuery(TopLinkTemplate.java:178)
    at com.eplinc.common.persistence.toplink.TopLinkTemplate.executeQuery(TopLinkTemplate.java:172)
    at com.epl.outletteller.dao.toplink.TopLinkOIDGeneratorDAO.generateId(TopLinkOIDGeneratorDAO.java:45)
    The call I am making is as follows :
    public long generateId(String name, long outletId) throws DataAccessException {
    TopLinkTemplate tlTemplate = new TopLinkTemplate();
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("AUTONUM.GET_NEXT_VALUE");
    call.addNamedArgument("autonum name");
    call.addNamedArgument("outlet id");
    call.addNamedOutputArgument("OUTPUT_1");
    ValueReadQuery query = new ValueReadQuery();
    query.setCall(call);
    query.addArgument("autonum name");
    query.addArgument("outlet id");
    Object[] parameters = new Object[2];
    parameters[0] = name;
    parameters[1] = Long.toString(outletId);
    Number uniqueNumber = (Number)tlTemplate.executeQuery(query,parameters);
    return uniqueNumber.longValue();
    This is my Table AUTONUM_SETTING
    AUTONUM_NAME AUTONUM_TYPE START_VAL END_VAL INCREMENT_VALUE
    TRAN_NUM GLOBAL 1 999999 1
    TRACE_NUM OUTLET 1 999999 1
    Any help would be appreciated. Thanks

Maybe you are looking for

  • Is it possible to add bookmarks to a PDF file with Adobe Reader for iOS?

    In the App Store write-up on this app, it said that one could "Use bookmarks to jump directly to a section in your PDF file."  But I don't see how one can add such bookmarks.  Do they only mean that you can use bookmarks that were already in the docu

  • Separate line item for taxes in accounting document of MIGO

    All SAP Gurus, As we can have separate line item for Freight amount (Freight amt credited) in accounting document for MIGO. Similarly is it possible to have separate line item for tax amount which is inventoried. Regards,

  • .m3u links on emusic will not open or download when clicked

    Trying to listen to the samples on emusic.com and nothing happens when I click a link. It shows the address of the .m3u file when I hover over it, and I can save that .m3u and listen to it on my computer, but nothing happens when I click it. I tried

  • Color Corrector & Image Quality Issues

    I have been putting some color corrector on some clips and after rendering, the quality is very skippy. Even after exporting to quicktime. I'm fine with it skipping in FCE, but when I export , I want it to be as clear as possible and no skipping. How

  • Sharepoint 2013 Permission Management Tool

    Hey,       I'm currently working for a small lab group that routinely fluctuates members. We are looking to create a new site collection with various unique permissions in the sub-sites. I was wondering if there is any third party application that ca