Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

PL/SQL stored procedures

 
Ambrose R Tati
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I've got a Pl/Sql stored procedure declared as:
add_address(first_name in varchar2, last_name in varchar2) is
begin
....
end;
I'm trying to call it from within java:
...
CallableStatement storedProc =
con.prepareCall("begin add_address(?,?); end;");
storedProc.setString(1,"AAAA");
storedProc.setString(2,"BBBB");
storedProc.execute();
....
The following exception is being thrown:
java.Sql.SQLException:[Oracle][ODBC Oracle Driver][Oracle OCI] ORA-00900: Invalid SQL statement.

Could anybody please point me in the right direction?
Thanks in advance
Ambrose Tati
 
Kapil Agrawal
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try using 'Call' for calling your stored procedure as:
...
CallableStatement storedProc =
con.prepareCall("{call add_address(?,?)}");
storedProc.setString(1,"AAAA");
storedProc.setString(2,"BBBB");
storedProc.execute();

[This message has been edited by Kapil Agrawal (edited November 06, 2000).]
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!