Skip to Main Content
Oracle in a Nutshell
book

Oracle in a Nutshell

by Rick Greenwald, David C. Kreines
December 2002
Intermediate to advanced content levelIntermediate to advanced
928 pages
85h 29m
English
O'Reilly Media, Inc.
Content preview from Oracle in a Nutshell

Creating a PL/SQL Wrapper

Once the Java class is loaded into the database, you will need to create a PL/SQL wrapper procedure to call it.

Classes that will be called from PL/SQL have two restrictions:

  • Methods published to SQL and PL/SQL must be declared static. PL/SQL has no mechanisms for instantiating nonstatic Java classes.

  • The classes must not issue any GUI calls (for example, to the AWT, the Abstract Windowing Toolkit) at runtime.

The syntax for creating this procedure is:

CREATE [OR REPLACE] {
   PROCEDURE procedure_name [(param[, param ...])] | 
   FUNCTION  function_name  [(param[, param ...])]
   RETURN plsql_type]}

        [AUTHID {DEFINER | CURRENT_USER}]
        [PARALLEL_ENABLE]
        [DETERMINISTIC]
   {IS | AS} LANGUAGE JAVA
   NAME 'java_method (java_type[, java_type] ...)
   [RETURN java_type];

where param is defined as:

        param := parameter_name [IN | OUT | IN OUT] plsql_type

where:

procedure_name/function_name

Specifies the name you want to give to the PL/SQL wrapper procedure or wrapper function that you are creating.

plsql_type

Specifies the PL/SQL type of a wrapper function’s return value.

AUTHID {DEFINER | CURRENT_USER}

Determines whether the stored subprogram runs with the database privileges of the user who created it (DEFINER) or of the user who invoked it (CURRENT_USER). The default is CURRENT_USER.

PARALLEL_ENABLE

Indicates that the function can be used in slave sessions in parallel DML evaluations. Parallel DML allows DML operations to be spread across multiple processes running in parallel to improve ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle Internals

Oracle Internals

Donald K. Burleson
Oracle PL/SQL

Oracle PL/SQL

Lewis Cunningham
Oracle Essentials: Oracle9i, Oracle8i and Oracle8, Second Edition

Oracle Essentials: Oracle9i, Oracle8i and Oracle8, Second Edition

Rick Greenwald, Robert Stackowiak, Jonathan Stern

Publisher Resources

ISBN: 0596003366Errata Page