PLS-001003 when calling stored procedure using JDBC ..

S

Sumukh

Hi all,
We are facing weired problem when we try to execute stored procedures
using JDBC.
Package was not getting compiled at all. We were getting

PLS-00103: Encountered the symbol "" when expecting one of the following:

Later I found a workaround of adding comment (--) after every line
in Stored proc.

Same stored procedure works without any problems, if we execute it on
the sql prompt. With JDBC only it gives errors.
We are using Oracle 8.1.7 and JDK 1.3 and classes12.zip

Has anyone faced this problem earlier ? How to split long lines in
stored procedure so that it can work with JDBC ?


Thanks

Sumukh
 
S

steve

Hi all,
We are facing weired problem when we try to execute stored procedures
using JDBC.
Package was not getting compiled at all. We were getting

PLS-00103: Encountered the symbol "" when expecting one of the following:

Later I found a workaround of adding comment (--) after every line
in Stored proc.

Same stored procedure works without any problems, if we execute it on
the sql prompt. With JDBC only it gives errors.
We are using Oracle 8.1.7 and JDK 1.3 and classes12.zip

Has anyone faced this problem earlier ? How to split long lines in
stored procedure so that it can work with JDBC ?


Thanks

Sumukh

simple!!
you cannot nest ' or '" in a database call , UNLESS you delimit them!!

EG.
a stupid way to code sql for oracle ( see nested ')
String The_qry =
"{?=call qareports.RETURN_oneinsprephed_rec("+recordIndex+")}";
cstmt =
(OracleCallableStatement)dbconn.prepareCall(The_qry);
cstmt.registerOutParameter(1, OracleTypes.CURSOR); bind
variable 1


I can break the above subquery by doing :
recordIndex="ZASF' "; // note the nested '




the CORRECT WAY ( ?=place holder for bind variable)

String The_qry = //used to identify this supplier,
externally
"{?=call qareports.RETURN_oneinsprephed_rec(?)}";
cstmt =
(OracleCallableStatement)dbconn.prepareCall(The_qry);
cstmt.registerOutParameter(1, OracleTypes.CURSOR); bind
variable 1
cstmt.setString(2, recordIndex); // bind variable 2

using the above oracle automatically delimits the " ' for me.


I would need to see the sql call to give you a code solution.


Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top