permaculture playing cards*
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 Murach's Java Servlets and JSP this week in the Servlets 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).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: PL/SQL stored procedures
 
Similar Threads
Execute pl/sql function which is having bind variables in java
Oracle wrong number or types of arguments...
Varchar & Varchar2 in Stored procedure
How to execute PL/SQL block within JSP ?
oracle stored procedure problem in 9i