15-10. Passing Data Objects from PL/SQL to Java
Problem
You have retrieved a row of data from the database using PL/SQL, and you want to populate a PL/SQL object type with that data and then pass the populated data object to a Java procedure.
Solution
Create a PL/SQL object type, along with a call specification for the Java stored procedure that you want to pass the object to. Ensure that the Java stored procedure accepts an object of type oracle.sql.STRUCT
and that the call specification accepts the PL/SQL object type you have created. For this recipe, the example will demonstrate the creation of a Java method that will accept an Employee
object and return that employee's corresponding department name. The Java code will be invoked from within ...
Get Oracle and PL/SQL Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.