A script-enabled browser is required for this page to function properly.

Mimicking a Foreign Function Prototype with PL/SQL

To mimic a foreign function prototype with PL/SQL:

  1. In the declaration section of the body of your PL/SQL package, define a PL/SQL subprogram that accepts and returns PL/SQL data type equivalents of the foreign function parameters; this is the subprogram that mimics the foreign function prototype.
  2. From the body of the mimicking subprogram, call the PL/SQL subprogram associated with the foreign function.
  3. Enter a PL/SQL subprogram prototype in the specification of your PL/SQL package.

Mimicking a foreign function prototype with PL/SQL: Example

Here is an example of mimicking a foreign function definition:

PACKAGE calc IS
 FUNCTION ADD(X IN BINARY_INTEGER, Y IN BINARY_INTEGER)
RETURN BINARY_INTEGER;
END;

PACKAGE BODY calc IS
 /*
  Given the foreign function prototype, int ADD(int X, int y),
  and the associated PL/SQL subprogram,
  FUNCTION ff_ADD(ff_handle,X,Y),
  this example shows how to mimic the foreign function
  definition in PL/SQL.
 */

 FUNCTION ADD(X IN BINARY_INTEGER, Y IN BINARY_INTEGER)
RETURN BINARY_INTEGER IS
 BEGIN
  RETURN(ff_ADD(ff_ADD_HANDLE,X,Y));
 END;

BEGIN
 ...
END;


About the PL/SQL interface

Invoking a foreign function from a PL/SQL interface