Call Specification
A call specification declares a Java method, C language subprogram, or
JavaScript function (either exported by a Multilingual Engine (MLE) module or declared inline as
part of the CREATE FUNCTION
and CREATE PROCEDURE
DDL
statements) so that it can be invoked from PL/SQL. You can also use the SQL
CALL
statement to invoke such a method or subprogram.
The call specification tells the database which JavaScript function, Java method, or which named subprogram in which shared library, to invoke when an invocation is made. It also tells the database what type conversions to make for the arguments and return value.
Topics
Prerequisites
To invoke a call specification, you may need additional privileges, for example, EXECUTE
privileges on a C library for a C call specification.
Syntax
call_spec ::=
java_declaration ::=
javascript_declaration ::=
c_declaration ::=
external_parameter ::=
property ::=
Semantics
call_spec
Maps a C procedure, Java method name, or JavaScript function name, parameter types, and return type to their SQL counterparts.
Call specifications can appear in PL/SQL standalone subprograms, package specifications and bodies, and type specifications and bodies. They cannot appear inside PL/SQL blocks.
java_declaration
string
Identifies the Java implementation of the method.
javascript_declaration
string
Identifies the JavaScript implementation of the function.
c_declaration
LIBRARY
lib_name
Identifies a library created by the "CREATE LIBRARY Statement".
EXTERNAL
Deprecated way of declaring a C subprogram, supported only for backward compatibility. Use EXTERNAL
in a C call specification if it contains defaulted arguments or constrained PL/SQL types, otherwise use the LANGUAGE
C
syntax.
Examples
Example 14-6 External Function Example
The hypothetical following statement creates a PL/SQL standalone function get_val
that registers the C subprogram c_get_val
as an external function. (The parameters have been omitted from this example.)
CREATE FUNCTION get_val
( x_val IN NUMBER,
y_val IN NUMBER,
image IN LONG RAW )
RETURN BINARY_INTEGER AS LANGUAGE C
NAME "c_get_val"
LIBRARY c_utils
PARAMETERS (...);
Related Topics
In this chapter:
In other chapters:
In other books:
-
Oracle Database SQL Language Reference for information about the
CALL
statement -
Oracle Database Development Guide for information about restrictions on user-defined functions that are called from SQL statements
-
Oracle Database Java Developer's Guide to learn how to write Java call specifications
-
Oracle Database Development Guide to learn how to write C call specifications
- Oracle Database JavaScript Developer's Guide to learn how to write JavaScript call specifications