15-4. Exposing a Java Class As a Stored Procedure

Problem

You have created a Java stored procedure and loaded it into the database, and now you want to access it via PL/SQL.

Solution

Create a PL/SQL call specification for the Java class. The PL/SQL call specification will essentially wrap the call to the Java class, enabling you to have access to the class from PL/SQL. The following code demonstrates the creation of a call specification for the Java class that was created in Recipe 15-1 and loaded into the database in Recipe 15-2.

CREATE OR REPLACE PROCEDURE get_it_emps AS LANGUAGE JAVA NAME 'Employees.getItEmps()';

How It Works

To make the Java class accessible from the database, you must create a PL/SQL call specification (sometimes known ...

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.