This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes PL/SQL stored procedures Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "PL/SQL stored procedures" Watch "PL/SQL stored procedures" New topic
Author

PL/SQL stored procedures

Ambrose R Tati
Greenhorn

Joined: Nov 06, 2000
Posts: 21
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

Joined: Nov 03, 2000
Posts: 11
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).]
 
wood burning stoves
 
subject: PL/SQL stored procedures