December 2010
Intermediate to advanced
451 pages
11h 16m
English
You want to utilize a PL/SQL function from a Java application that uses the JDBC API to connect to an Oracle Database and returns a value to the Java application.
Use the JDBC API and a CallableStatement to invoke the PL/SQL function by passing a Java String containing the function call to the CallableStatement. The following example demonstrates a Java method that accepts a parameter of type double and then makes a JDBC call to the PL/SQL function calc_quarter_hour using the parameter. It is assumed that this Java method is to be added into the class that was created in Recipe 16-1.
public void calcQuarterHour(double hours)
throws SQLException { float returnValue; ...Read now
Unlock full access