O'Reilly logo

Java Programming with Oracle SQLJ by Jason Price

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.5. Publishing Class Methods

The process of creating PL/SQL wrappers is known as publishing the Java methods in the database. If your Java method does not return a value, i.e., is a procedure, then you must use the CREATE PROCEDURE statement to create a procedure wrapper. If your Java method returns a value, i.e., is a function, then you must use the CREATE FUNCTION statement. The syntax for the CREATE PROCEDURE/FUNCTION statement to create a wrapper is as follows.

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]';
/

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

The syntax elements and options are as follows:

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required