Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling a function vs a procedure on Oracle with CallableStatement

 
Tim Vries
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic