Error calling PL/SQL stored procedure

Hi,
I'm pretty new to JDeveloper having used NetBeans for the last few years.
I'm getting an error when trying to call a PL/SQL stored procedure. When I click on any of the oracle errors I get an "unable to find source file" message. The errors occurs in call.execute(). The error message and Java code are listed below. Any help is much appreciated.
Cheers,
Stevie
Errors:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 33
     at java.lang.String.charAt(String.java:558)
     at oracle.jdbc.driver.OracleSql.handleODBC(OracleSql.java:877)
     at oracle.jdbc.driver.OracleSql.parse(OracleSql.java:811)
     at oracle.jdbc.driver.OracleSql.getSql(OracleSql.java:284)
     at oracle.jdbc.driver.OracleSql.getSqlBytes(OracleSql.java:538)
     at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:169)
     at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableStatement.java:873)
     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
     at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
     at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3093)
     at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4286)
     at oracle.CallPLSQL.callLMO(CallPLSQL.java:118)
     at oracle.TestHarness.main(TestHarness.java:18)
Jave Code:
package oracle;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Types;
public class CallPLSQL {
private Connection conn;
public CallPLSQL() {
*Constructor.
try {
//Register Oracle Database Drive
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//set connection
String connectionString="jdbc:oracle:thin:TSD/TSD@DEV:1526:DEVELOP";
this.setConn(DriverManager.getConnection(connectionString,"TSD", "TSD"));
} catch (SQLException ex) {
public int callproc () throws SQLException {
CallableStatement call;
String callString = "{call proc" +
call = conn.prepareCall(callString);
call.setInt(1, 120289);
call.setInt(2, 2008);
call.registerOutParameter(3, Types.INTEGER);
call.registerOutParameter(4, Types.INTEGER);
call.registerOutParameter(5, Types.INTEGER);
call.registerOutParameter(6, Types.DATE);
call.registerOutParameter(7, Types.VARCHAR);
call.registerOutParameter(8, Types.INTEGER);
call.registerOutParameter(9, Types.INTEGER);
call.execute();
int i = call.getInt("app_id");
return i;
public void setConn(Connection conn) {
this.conn = conn;
public Connection getConn() {
return conn;
}

I've fixed it now. I'd missed a } in prepareCall. What a doughball.

Similar Messages

  • How to call pl/sql stored procedure in JDBC query dialogbox

    Hi,
    how to call pl/sql stored procedure in JDBC query dialogbox(reports 9i) .
    Cheers,
    Raghu

    please refer : Re: problem If you have more doubts, please ask in that question.

  • How to call PL/SQL stored procedure using ODBC?

    Could anyone tell me how can I call PL/SQL stored procedure using
    ODBC? Are there any sample codes?
    Thanx!
    null

    You are correct on all counts, they all should work.
    Oracle Product Development Team wrote:
    : Hi,
    : I don't know the exact syntax in ODBC, but reasoning by analogy
    : with other API's, I'd bet one of the following works
    : (for a call to: procedure my_proc(n1 number, n2 number);):
    : "{ my_proc(1,2); }"
    : "{ call my_proc(1,2); }"
    : "{ begin my_proc(1,2); end }"
    : "begin my_proc(1,2); end;"
    : "begin my_proc(1,2); end"
    : Hope this helps. - Pierre
    : jiangbuf (guest) wrote:
    : : Could anyone tell me how can I call PL/SQL stored procedure
    : using
    : : ODBC? Are there any sample codes?
    : : Thanx!
    : Oracle Technology Network
    : http://technet.oracle.com
    null

  • How to call PL-SQL/stored procedure in Creator

    Anybody can tell how to call PL-SQL/Stored procedures inside creator...

    Hi!!!
    You can see this topic http://forum.sun.com/jive/thread.jspa?threadID=106046
    There is how to call oracle stored procedures. Also I put a lot of links in these topic doing reference stored procedures. I have one that it tells specially how to call oracle stored procedures from java, is in spanish but you can understand the code.;-)
    http://yoprogramador.vampisol.com/index.php?title=pl_sql_oracle_desde_java&more=1&c=1&tb=1&pb=1
    Byeee

  • Calling PL/SQL stored procedure from JSP tag

    Hello,
    I need to call a PL/SQL procedure from a JSP tag , I donot want to use any Bean to call the PL/SQL procedure. How would I call PL/SQL stored procedure from within JSP using JSP tag library, need some code.
    Thank you
    Syed

    need to call a PL/SQL procedure from a JSP tag , I donot want to use any Bean to call the PL/SQL procedure. How would I call PL/SQL stored procedure from within JSP using JSP tag library, need some code.
    regards
    Indira Rani Bandi

  • Error Calling a simple stored procedure

    Hello. I'm using the code below to call a simple stored procedure which returns a number. Why does it throw the exception (Also below)?
    Thank you,
    Alek
    =======================
    Code:
    import java.sql.*;
    public class Connect
    public static void main (String[] args)
    Connection conn = null;
    //CallableStatement stmtMySQL = null;
    long local_callkey = 0;
    try
    Class.forName("com.mysql.jdbc.Driver");
    String userName = "abc";
    String password = "def";
    String url = "jdbc:mysql://mysqlserver/sxma";
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();
    conn = DriverManager.getConnection (url, userName, password);
    System.out.println ("Database connection established");
    String theMySQLCall = "{?=call sxma.sp_getnumber()}";
    CallableStatement stmtMySQL = conn.prepareCall(theMySQLCall);
    stmtMySQL.registerOutParameter(1, Types.INTEGER);
    stmtMySQL.execute();
    int res = stmtMySQL.getInt(1);
    if(res!=0)
    throw new Exception("MySQL Query exception return code: " + String.valueOf(res) + ")");
    else
    local_callkey = stmtMySQL.getLong(1);
    System.out.println("Local key is: " + local_callkey);
    catch (Exception e)
    System.err.println ("Cannot connect to database server!");
    e.printStackTrace();
    finally
    if (conn != null)
    try
    conn.close ();
    System.out.println ("Database connection terminated");
    catch (Exception e) { /* ignore close errors */ }
    ================
    Exception:
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at java.lang.String.charAt(String.java:444)
         at com.mysql.jdbc.StringUtils.indexOfIgnoreCaseRespectQuotes(StringUtils.java:951)
         at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1277)
         at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:3640)
         at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:506)
         at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:401)
         at com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4072)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4146)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4120)
         at Connect.main(Connect.java:20)
    Thank you for your help

    Well, there's certainly something about that line that it doesn't like.
    I'm not really familiar enough with MySQL to remote-debug this one for you, but it seems to be dying while trying to reconcile that call to its metadata for the sproc. Check the sproc declaration -does it return a single out value? Or does it have a single out value in the parameter list (not the same thing, I think) ? And so on.
    Also, with the amended call that I provided is the failing stack trace identical, or slightly different? If different, could you post that too please?
    Finally, do you have a known good sproc call that you can sanity check against? Perhaps take one of the examples from the MySQL site and check that that will work with their reference code?

  • How to call a sql stored procedure in java...... HELP

    Hi I am making an application for taking backup in sql automatically so i have created a dts package which is called by a stored procedure. Now the problem is that how to call that stored procedure in a Java program so that after running my java program i get my database backup.
    Please please solve my problem.
    thanks in advance.
    If possible please send the code.
    Message was edited by:
    Andy_Davis
    Message was edited by:
    Andy_Davis

    Hi... I am trying to create a dts package which is called by a stored procedure... How can i do this? IF possible can you please send me the code as well..
    Thanks a ton...
    Susan_Davis

  • Calling ORACLE/SQL stored procedure...

    Hello,
    Is it possible to invoke non-parametrized Stored Procedures (a procedure that, neither having IN parameter nor OUT parameter) from BizTalk.?
    Any suggestion/solution?
    Thanks,
    Prajakt.
    Praj Dixit

    Praj,
    Yes possible.
    Create a .NET helper which will call the stored procedure and handle the return value/recordset from sp and in your BizTalk artifacts call this .NET helper/wrapper to SQL stored procedure. 
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Error after calling PL/SQL Stored Procedure

    I have a JSP/Struts application that has a master table and several subordinate tables. Each table has inserts, updates and deletes handled by a stored procedure.
    When a record is inserted into any of the subordinate tables, the stored procedure gets called successfully and the data is saved, but an error condition is raised:
    JBO-26041: Failed to post data to database during "Rollback to Savepoint": SQL Statement "null".
    ORA-01086: savepoint 'BO_SP' never established
    The stored procedures execute a commit.
    On the master table, if a search has been performed and returned rows, inserting a new row raises:
    JBO-27021: Failed to load CustomDatum value at index 8 with java object of type oracle.jbo.domain.Raw due to java.sql.SQLException.
    Stream has already been closed
    There is a BLOB data type column in the table, but it is not included in the EO or VO, nor is it referenced by the stored procedure.
    If a search is performed and no records are returned, the stored procedure inserts the new row and no errors are raised.
    I'm stumped...anybody got any ideas?

    I've fixed it now. I'd missed a } in prepareCall. What a doughball.

  • How Do I Call PL/SQL Stored Procedure That Returns String Array??

    I Have Problem Calling An Oracle(8i) Stored Procedure That Returns Array Type (Multi Rows)
    (As Good As String Array Type..)
    In This Fourm, I Can't Find Out Example Source.
    (Question is Exist.. But No Answer..)
    I Want An Example,, Because I'm A Beginner...
    (I Wonder...)
    If It Is Impossible, Please Told Me.. "Impossible"
    Then, I'll Give Up to Resolve This Way.....
    Please Help Me !!!
    Thanks in advance,

    // Try the following, I appologize that I have not compiled and run this ... but it is headed in the right direction
    import java.sql.*;
    class RunStoredProc
    public static void main(String args[])
    throws SQLException
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    catch(Exception ex)
    ex.printStackTrace();
    java.util.Properties props = new java.util.Properties();
    props.put("user", "********"); // you need to replace stars with db userid
    props.put("password", "********"); // you need to replace stars with userid db password
              // below replace machine.domain.com and DBNAME, and port address if different than 1521
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@machine.domain.com:1521:DBNAME", props);
    // replace "Your Stored Procedure" with your stored procedure
    CallableStatement stmt = conn.prepareCall("Your Stored Procedure");
    ResultSet rset = stmt.execute();
    while(rset.next())
    System.out.println(rset.getString(1));

  • How to call PL/SQL stored procedure with TWO or more arguments from URL?

    Hi all,
    does anybody know, how to call stored procedure with more than one argument?
    How to do this with one argument is known -
    <img src="#OWNER#.retreive_img_data?i_id=#IMG_ID#" width="70" height="80" alt="No Picture">
    But if I need to call procedure with two formal parameters? And need to pass through URL, for example, two page item values?

    Just separate with an "&". Using your previous example, I'll add i_name and i_type:
    <img src="#OWNER#.retreive_img_data?i_id=#IMG_ID#&i_name=somename&i_type=jpg" width="70" height="80" alt="No Picture" />
    Tyler

  • How to call pl sql stored procedure or function in OAF 10 plus versions

    Hello All,
    I am using J-dev 10.1.3.3.0.3 version.I want to call stored procedure from package in one of my controller. I tried using "txn.createCallableStatement" but it is saying that createcallablemethod is not available.Does any one knows about this.
    Thanks

    Try the OA Framework Forum.
    John

  • Calling pl/sql stored procedure from shell script ( kshell)

    hello.,
    i have written a stored procedure. i need to call this stored procedure from a unix shell script ( korn shell).
    can anyone please help me how can i do it.actually there are 3 stored procedures. so my shell script has to call each stored procedure, execute it then go to next stored procedure execute it.
    if by chance inbetween any stored procedure do not execute then the shell script has to tell me that this stored procedure failed to execute.
    please help me in this.
    thanks
    madan

    Sorry Madan,
    Following is the complete solutiion:
    !# /usr/bin/ksh
    sqlplus -s user/pass@server << EOF > a.log
    exec proc1;
    exec proc2;
    exec proc3;EOF
    if [ $? -eq 0 ]
    then
            echo "\n Procedures completed successfully at `date`"
    else
            echo "!!! FAILED!!!"
            echo "Details can be found in a.log File"
    fi

  • Calling PL/Sql Stored Procedure from java file

    Having problem in calling oracle stored procedure using bc4j.

    in ApplicationModuleImpl you can use following e.g.
    on client side use a custom method to access
    try {
    DBTransaction dBTransaction = getDBTransaction();
    String stmt = "CALL CHANGE_OWNER( ?, ?)";
    CallableStatement callableStatement = dBTransaction.createCallableStatement(stmt,DBTransaction.DEFAULT);
    callableStatement.setString( 1, oldOwner );
    callableStatement.setString( 2, newOwner );
    callableStatement.execute();
    } catch (SQLException ex) {
    throw new JboException(ex);
    }

  • Calling PL/SQL stored procedure from XML template

    I've a requirement to call a store procedure/function/package from XML template. How can i achieve this?

    >
    XML template
    >
    do you mean "data template" with sql statement?
    below using package in sql statement and data structure element for data template
    <?xml version="1.0" encoding="UTF-8" ?>
    <dataTemplate name="XXCUSTOM_PKG" defaultPackage="XXCUSTOM_PKG" version="1.0">
    <sqlStatement name="Q_INVOICES">
    select
    XXCUSTOM_PKG.invoice_type()
    from <some_table>
    </sqlStatement>
    <dataTrigger name="beforeReportTrigger" source="XXCUSTOM_PKG.beforereport"/>
    <dataStructure>
    <element name="in_title"  dataType="varchar2" value="XXCUSTOM_PKG.in_titleformula()"/>     
    </dataStructure>
    <dataTrigger name="afterReportTrigger" source="XXCUSTOM_PKG.afterreport()"/>
    </dataTemplate>or it's xml data for report?

Maybe you are looking for

  • Mini Displayport To HDMI adapter

    Just installed Lion on my 2010 MacBook Pro 15" (Intel Core i7). I bought a mini displayport to HDMI adapter and it doesn't seem to detect my 27" LED monitor. The screen flashes for a moment on my MacBook and my external monitor wakes up but suddenly

  • Problems with Memory on upgrading

    Problems with Memory. I Dide not hace space to upgrade. Now i do, but It still cancels for lack of space

  • Save and make file name change

    When I save as, I want the image to be the name of the file I type so that all subsequent changes can be saved only by clicking "save" and not having to browse to and rename the file EVERY TIME. Sometimes this works properly, sometimes it doesn't. It

  • Help in AS3 Sprite

    Hello All, I got this Error : 1061: Call to a possibly undefined method addChild through a reference with static type Class. what I'm trying to do : I have create a new class called Graph and make it extends Sprite and  add a scroolpane to my stage a

  • Sony Handicam connectio to iMovie

    Can't connect Sony Digital Handicam DVR-TRV25 to my brand new MacBook Pro 13. I have iMove, but it does not recognize the USB connection to my Handicam. Any suggestions?