It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes Calling Oracle functions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Calling Oracle functions" Watch "Calling Oracle functions" New topic

Calling Oracle functions

Hendrik Coetzee

Joined: Nov 12, 2004
Posts: 1

Having a bit of trouble when calling an Oracle function. In the code below, as soon as I call the execute() function, I get the exception. I don't get it with stored procedured that don't return values, but as soon as a stored procedure or function returns a resultset (or value) this exception is thrown. This is using the latest ojdbc14.jar drivers on an 8i database.

Would greatly appreciate any ideas / thoughts.

Thank you

Exception in thread "main" java.lang.NullPointerException
at oracle.jdbc.driver.T4C8Oall.getNumRows(
at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(
at oracle.jdbc.driver.OraclePreparedStatement.execute(
at oracle.jdbc.driver.OracleCallableStatement.execute(
at com.ccoster.beans.DBConn.execFunction(
at OSDXMLPublish.runCIFEngine(
at OSDXMLPublish.start(
at OSDXMLPublish.main(
nilesh Katakkar
Ranch Hand

Joined: Oct 27, 2004
Posts: 35
Whats the Java version you are using ?

ojdbc14.jar is used with Java 1.4.x ? For older versions you will still need to go to classes12.jar

nilesh<br />
nilesh Katakkar
Ranch Hand

Joined: Oct 27, 2004
Posts: 35

String funct = "{ ? = ci_publish_client_data(?) }";

Should be

String funct = "{ call ? = ci_publish_client_data(?) }";
I agree. Here's the link:
subject: Calling Oracle functions
It's not a secret anymore!