Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes Calling a function vs a procedure on Oracle with CallableStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Calling a function vs a procedure on Oracle with CallableStatement" Watch "Calling a function vs a procedure on Oracle with CallableStatement" New topic
Author

Calling a function vs a procedure on Oracle with CallableStatement

Tim Vries
Greenhorn

Joined: Nov 29, 2001
Posts: 8
Is it possible to call a function with CallableStatement vs calling a stored procedure? If not, is there another way to do this?
When I try to execute the following code :
String xyz = "{call TEST_FUNCTION(?,?)}";
cs = conn.prepareCall(xyz);
cs.setString(1, "XYZ");
cs.registerOutParameter(2,Types.VARCHAR);
cs.execute();
... I get the following error from the database:
Sql Exception : java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00221: 'TEST_FUNCTION' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling a function vs a procedure on Oracle with CallableStatement