Can't execute Oracle Stored Procedure using JDBC

Hi all,
I'm fairly new to JDBC and Oracle, so pardon my ignorance/lack of knowledge in this subject matter. I am trying to call a stored procedure named get_countries that has no parameters using JDBC. I do this by executing the following lines of code:
CallableStatement cs = con.prepareCall("{call get_countries}");
ResultSet rs = cs.executeQuery();But I get the following exception thrown:
Exception in thread "main" java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'GET_COUNTRIES'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
at oracle.jdbc.driver.DatabaseError.throwSqlException(_DatabaseError.java:112_)
at oracle.jdbc.driver.T4CTTIoer.processError(_T4CTTIoer.java:331_)
at oracle.jdbc.driver.T4CTTIoer.processError(_T4CTTIoer.java:288_)
at oracle.jdbc.driver.T4C8Oall.receive(_T4C8Oall.java:745_)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(_T4CCallableStatement.java:218_)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(_T4CCallableStatement.java:969_)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(_OracleStatement.java:1190_)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(_OraclePreparedStatement.java:3370_)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(_OraclePreparedStatement.java:3415_)
at JDBCTest.main(_JDBCTest.java:44_)
This makes no sense to me because there are no parameters that I need to pass. So I'm guessing this is something that I don't know about JDBC or about Oracle. I've searched Google for the past hour and a half and still haven't found anything that explains what might be the problem. I've also been following this guide ([http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html]) and I'm doing it exactly the same way, but for some reason it works for them.
Anyone know what I'm doing wrong?
Thanks for your help in advance. I really appreciate it!

I went to a few forums and asked the same question. The boys down at Oracle Community Forums shed some light on this subject and, with their help, I was able to figure it out. Here is the thread for those who want to read: [My Thread @ Oracle Community Forums|http://forums.oracle.com/forums/thread.jspa?messageID=2721348?].
THE SOLUTION
cs = con.prepareCall("{ call get_countries(?) }");
cs.registerOutParameter(1, OracleTypes.CURSOR);
cs.execute();
ResultSet rs = ((OracleCallableStatement) cs).getCursor(1);

Similar Messages

  • Passing XMLType Data into oracle stored procedure using JDBC

    Hi Friends,
    I have requirement where my oracle stored procedure accepts XML file as an input. This XML File is generated in runtime using java, I need to pass that xml file using JDBC to oracle stored procedure. Please let me know the fesibile solution for this problem.
    Following are the environment details
    JDK Version: 1.6
    Oracle: 10g
    Server: Tomcat 6.x
    Thanks in Advance

    user4898687 wrote:
    I have requirement where my oracle stored procedure accepts XML file as an input. This XML File is generated in runtime using java, I need to pass that xml file using JDBC to oracle stored procedure. Please let me know the fesibile solution for this problem.As stated - no.
    A 'file' is a file system entity. There is no way to pass a 'file' anywhere. Not PL/SQL. Not java.
    Now you can pass a file path (a string) in java and to PL/SQL.
    Or you can pass xml data (a string) in java and to PL/SQL. For PL/SQL you could use eithe a varchar2, if the xml is rather small, or a blob/clob.

  • Can sqltaglib.tld execute Oracle stored procedure?

    Is it possible to execute Oracle stored procedure through Oralce's own sqltaglib.tld. The sqltaglib on-line manual only shows how to run SQL query/insert/update statement.
    Thanks,

    I went to a few forums and asked the same question. The boys down at Oracle Community Forums shed some light on this subject and, with their help, I was able to figure it out. Here is the thread for those who want to read: [My Thread @ Oracle Community Forums|http://forums.oracle.com/forums/thread.jspa?messageID=2721348?].
    THE SOLUTION
    cs = con.prepareCall("{ call get_countries(?) }");
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.execute();
    ResultSet rs = ((OracleCallableStatement) cs).getCursor(1);

  • Weird Problem calling Stored Procedure using JDBC

    Scenario is..
    I have J2EE application and calling stored procedure using JDBC.
    My application connects to instance "A" of testDB.
    Schema "A" does NOT own any packages/procedure but granted execute on oracle packages/procedures that reside in schema "B" of testDB.
    In java code I call procedure(proc1) in package(pac1) which internally calls procedure(proc2) in package(pac2).
    The problem occurs when procedure pac2.proc2 is modified. After the modification, my java code fails and throws an exception "User-Defined Exception" and I am also getting "ORA-06508: PL/SQL: could not find program unit being called". This clears up only if I bounce the web container. (This doesn't happen if I modify pac1.proc1 and run my application)
    Has any one faced this problem? Please suggest if any thing can be changed in jdbc code to fix this problem.
    Thanks

    Hi,
    I assume these are PL/SQL packages and that the changes are made at the package specification level?
    If so, it looks like you are hitting the PL/SQL dependencies rules. In other words, if the spec of proc2 is changed, then proc1 is invalidated, since proc1 still depends on the old version of proc2's spec. As a result, if you try to run proc1, its spec must either be explicitly rewritten before it could run again or implicitly recompiled first, if the (implicit) recompilation fails, it won’t run.
    Kuassi http://db360.blogspot.com

  • Creating and calling stored procedure using jdbc

    When I try to create and call a stored procedure using JDBC a very confusing error message about non-existence of the procedure just created is thrown. Using Informix database (IDS 10). Any pointers to point out what am doing wrong would be great!
    Thanks
    import java.io.FileNotFoundException;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Scanner;
    public class CreateStoredProc {
    public static void main(String args[]){
    if (0 == args.length)
    return;
    try {
    Class.forName("com.informix.jdbc.IfxDriver");
    Connection conn = DriverManager.getConnection("jdbc:informix-sqli://10.76.244.120:30000/sampledb:INFORMIXSERVER=krisunda;user=root;password=cisco");
    String q = " create procedure runproc() "+
    " define i int; "+
    " let i = 0; "+
    " end procedure; "+
    " execute procedure runproc(); ";
    Statement stmt = conn.createStatement ();
    stmt.execute (q);
    } catch (Exception e) {
    e.printStackTrace();
    The stack trace:
    java.sql.SQLException: Routine (runproc) can not be resolved.
    at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3204)
    at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3518)
    at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2353)
    at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2269)
    at com.informix.jdbc.IfxSqli.executeExecute(IfxSqli.java:2157)
    at com.informix.jdbc.IfxSqli.executeExecute(IfxSqli.java:2132)
    at com.informix.jdbc.IfxResultSet.b(IfxResultSet.java:378)
    at com.informix.jdbc.IfxStatement.a(IfxStatement.java:1299)
    at com.informix.jdbc.IfxStatement.executeImpl(IfxStatement.java:1269)
    at com.informix.jdbc.IfxStatement.c(IfxStatement.java:989)
    at com.informix.jdbc.IfxStatement.execute(IfxStatement.java:875)
    at CreateStoredProc.main(CreateStoredProc.java:37)
    Caused by: java.sql.SQLException
    at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373)
    at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3523)
    ... 10 more

    DriverManager.getConnection("jdbc:informix-sqli://10.76.244.120:30000/sampledb:INFORMIXSERVER=krisunda;user=root;password=cisco");check with ur sys admin wheather the particular user in the database has >execute privilage(rights) also.i mean execute the SP in the DB level.I guess that a root user will have the enough right.
    String q = " create procedure runproc() "+
    " define i int; "+<" let i = 0; "+
    " end procedure; "+
    " execute procedure runproc(); ";
    Statement stmt = conn.createStatement ();
    stmt.execute (q);Try to use the following code:
    String q = " create procedure runproc() "+
    " define i int; "+
    " let i = 0; "+
    " end procedure; "
    Statement stmt = conn.createStatement ();
    stmt.execute (q);
    q=" execute procedure runproc(); ";
    stmt.execute (q);
    Because maybe the driver failed to precompile your sql once, so that nothing happen.

  • Execute oracle stored procedure from C# always returns null

    Hi,
    I'm trying to execute a stored procedure on oracle 9i. I'm using .Net OracleClient provider.
    Apparently, I can execute the stored procedure, but it always returns null as a result (actually all the sp's I have there returns null)! I can execute any text statement against the database successfully, and also I can execute the stored procedure using Toad.
    This is not the first time for me to call an oracle stored procedure, but this really is giving me a hard time! Can anyone help please?
    Below are the SP, and the code used from .Net to call it, if that can help.
    Oracle SP:
    CREATE OR REPLACE PROCEDURE APIECARE.CHECK_EXISTENCE(l_number IN NUMBER) AS
    v_status VARCHAR2(5) := NULL;
    BEGIN
    BEGIN
    SELECT CHECK_NO_EXISTENCE(to_char(l_number))
    INTO v_status
    FROM DUAL;
    EXCEPTION WHEN OTHERS THEN
    v_status := NULL;
    END;
    DBMS_OUTPUT.PUT_LINE(v_status);
    END CHECK_CONTRNO_EXISTENCE;
    C# Code:
    string connStr = "Data Source=datasource;Persist Security Info=True;User ID=user;Password=pass;Unicode=True";
    OracleConnection conn = new OracleConnection(connStr);
    OracleParameter param1 = new OracleParameter();
    param1.ParameterName = "v_status";
    param1.OracleType = OracleType.VarChar;
    param1.Size = 5;
    param1.Direction = ParameterDirection.Input;
    OracleParameter param2 = new OracleParameter();
    param2.ParameterName = "l_number";
    param2.OracleType = OracleType.Number;
    param2.Direction = ParameterDirection.Input;
    param2.Value = 006550249;
    OracleParameter[] oraParams = new OracleParameter[] { param1, param2 };
    OracleCommand cmd = new OracleCommand("CHECK_EXISTENCE", conn);
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddRange(oraParams);
    conn.Open();
    object result = cmd.ExecuteScalar();
    conn.Close();

    Hi,
    Does that actually execute? You're passing two parameters to a procedure that only takews 1 and get no error?
    Your stored procedure doesnt return anything and has no output parameters, what are you expecting to be returned exactly?
    If you're trying to access V_STATUS you'll need to declare that as either an output parameter of the procedure, or return value of the function, and also access it via accessing Param.Value, not as the result of ExecuteScalar.
    See if this helps.
    Cheers,
    Greg
    create or replace function myfunc(myinvar in varchar2, myoutvar out varchar2) return varchar2
    is
    retval varchar2(50);
    begin
    myoutvar := myinvar;
    retval := 'the return value';
    return retval;
    end;
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    public class odpfuncparams
         public static void Main()
          OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl");
          con.Open();
          OracleCommand cmd = new OracleCommand("myfunc", con);
          cmd.CommandType = CommandType.StoredProcedure;
          OracleParameter retval = new OracleParameter("retval",OracleDbType.Varchar2,50);
          retval.Direction = ParameterDirection.ReturnValue;
          cmd.Parameters.Add(retval);
          OracleParameter inval = new OracleParameter("inval",OracleDbType.Varchar2);
          inval.Direction = ParameterDirection.Input; 
          inval.Value="hello world";
          cmd.Parameters.Add(inval);
          OracleParameter outval = new OracleParameter("outval",OracleDbType.Varchar2,50);
          outval.Direction = ParameterDirection.Output;
          cmd.Parameters.Add(outval);
          cmd.ExecuteNonQuery();
          Console.WriteLine("return value is {0}, out value is {1}",retval.Value,outval.Value);
          con.Close();
    }

  • How to execute oracle stored procedure through php as externally?

    hi...
    i am searching for the way that how to execute oracle stored procedure through web service, i am using php and mysql, i have some stored procedures in oracale database, i want to execute them, from php, means the database will be remain mysql, and the stored procedures of oracle will be executed externally...
    Kind regards,
    Wilayat.

    Ok, so first of all this is a kind of strange question. Since Oracle and MYSQL can happily live side by side.
    Make sure you have the oracle client (instant or regular ) installed and OCI_8 is set up and working correctly in PHP. If it is, when you run the phpinfo() routine you will see oci_8 on there. IF PHP connects just fine from the command line yet apache wont connect check permissions and things like the LD_Library Path.
    Then in php, right along with your MySQL statements run Oracle Statements eg:
    <?php
    $OraDB = oci_connect(name,pass,tnsname);
    $MySQLdb = mysql_connect([parms]);
    $oraQueryText = "begin sp_some_proc([some parms]); end;" ;
    $mysqlQuery = " Some mysql Query";
    $oraQuery = oci_parse($OraDB,$oraQueryText );
    oci_execute($oraQuery);
    mysql_execute([parms]);
    ?>
    Use the standard fetch code to get data from either of them.
    If you cannot and I mean absolutely cannot get an admin to link in OCI_8 then you still have recourse although it will be tedious as hell. PHP allows you to exec calls to the OS. You still MUST make sure the Oracle Client is installed and that sqlplus runs from the command line. You will more then likely have to have a shell script written to do this as well, but maybe not as I have never tried it with the exception of capturing the return value of sqlplus and you will have to dig into sqlplus to get it to send its results to a file you can then parse with php.
    Good Luck!

  • 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

  • Is it possible to execute a stored procedure using the JDBC adapter?

    Hi all,
    Can anybody confirm whether we can execute a stored procedure created in a database using the processing parameters of a JDBC adapter of a communication channel?
    If yes, then please let me know how (may be with an example)
    Thanks.

    Yes, that is possible. You have to chose EXECUTE in the action field to execute the stored procedure. Here's a little piece on the JDBC receiver:
    JDBC Receiver
    For writing data to an SQL database you also need to define a strict data type. The general format is like this:
        <ns:MT_RECORDSET>
              <STATEMENT>
                   <TABLE_NAME ACTION="">
                        <TABLE/>
                        <ACCESS>
                             <FIELD1/>
                             <FIELD2/>
                             <FIELDn/>
                        </ACCESS>
                        <KEY>
                             <ID compareOperation=""/>
                             <FIELDx compareOperation=""/>
                        </KEY>
                   </TABLE_NAME>
              </STATEMENT>
    </ns:MT_RECORDSET>
    This recordset represents an SQL statement like "update TABLE1 set FIELD1=123, FIELD2=456, FIELDn='xyz' where ID=12345 and FIELDx is NULL"
    MT_RECORDSET is the name of the Message Type used.
      For the value of the attribute ACTION you can choose from the following values:
         UPDATE : updates the given fields in the table with their new values
         INSERT : insert the given fields as a new row in the table
         UPDATE_INSERT : insert rows in the table when update is not possible
         DELETE : deletes given fields from the table
         SELECT : selects given fields from the table. Note that this option returns a response in the JDBC Sender form!
         EXECUTE : execution of a stored SQL procedure
         SQL_QUERY | SQL_DML : option to transfer more complex SQL statements to the database
      The attribute compareOperation can have the following values:
         EQ : equal
         NEQ : not equal
         LT : less than
         LTEQ : less than or equal to
         GT : greater than
         GTEQ : greater than or equal to
         LIKE : used to compare strings

  • Execute oracle stored procedure in CF8

    I am executing a stored procedure like this.
    <cfstoredproc procedure="GetAction"
    datasource="test_DSN">
    <cfprocparam cfsqltype="CF_SQL_INTEGER"
    dbvarname="actionId" type="in" value="1">
    <cfprocresult name="actions" resultset="1" >
    </cfstoredproc>
    and my stored procedure in oracle is,
    create or replace function GetAction(actionId IN
    ACTION.ID%TYPE)
    RETURN ACTION%ROWTYPE
    IS
    actions
    ACTION%ROWTYPE;
    begin
    select *
    INTO actions
    FROM ACTION WHERE ID = actionId;
    RETURN actions;
    end GetAction;
    then I get the error message like,
    ORA-01008: not all variables bound
    Please help me on this.
    Thanx

    If you want to return a result set (result of a query) from
    your PL/SQL, you will have to do what Daverms suggested and convert
    your function to a procedure
    and use a reference cursor to return your result set. Your
    procedure will have to be contained in a package in order for you
    to declare a ref cursor "globally" so that it can be accessed by
    CF.
    Oh, and be sure to change your cfstoredproc procedure
    parameter to add the package name to the proc name.
    <cfstoredproc procedure="your_pkg.GetAction"
    datasource="test_DSN">
    Phil

  • Execute Oracle Stored Procedure from Excel

    Is it possible to execute an Oracle Stored Procedure from Microsoft Excel and return the result of the Oracle Store Procedure into the excel spreadsheet.

    Yes. You can use Oracle Objects for OLE to accomplish this. It comes with Excel examples and an online help file with many more examples.

  • 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.

  • Passing DATE parameters to Oracle Stored Procedures using ADO

    Does anyone know how can I pass a date parameter to an Oracle
    Stored Procedure? The IN parameter of the procedure is of type
    DATE and the ADO parameter is of type DBDate (I've tried Date
    and DBTimeStamp,too). The execution freezes at "Cmd.Execute".
    Can anyone suggest a solution?
    Thanx for any tips

    As far as I know the documentation on CR & stored procedures says that the REF CURSOR has to be a strongly bound one.
    Could you go into a little more detail? Do you mean I should put a multi-valued parameter into a REF CURSOR? Can you post some code snippets here?

  • 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