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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.