15-5. Executing a Java Stored Procedure

Problem

You want to execute a Java stored procedure that you have created from within SQL*Plus.

Solution

Call the PL/SQL call specification that maps to the Java stored procedure. The following SQL*Plus code demonstrates how to execute the Java class for which you created a call specification in Recipe 15-3.

SQL> set serveroutput on SQL> call dbms_java.set_output(2000); Call completed. SQL> exec get_it_emps; Alexander Hunold AHUNOLD Bruce Ernst BERNST David Austin DAUSTIN Valli Pataballa VPATABAL Diana Lorentz DLORENTZ PL/SQL procedure successfully completed.

As you can see, when the code is executed, the results are returned to SQL*Plus and displayed as if it were the output of a PL/SQL procedure ...

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.