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

Associating a PL/SQL Subprogram with a Foreign Function

To associate a PL/SQL subprogram with a foreign function:

  1. Obtain a function handle using ORA_FFI.FIND_FUNCTION or ORA_FFI.REGISTER_FUNCTION.
  2. In the declaration section of the body of your PL/SQL package, define a PL/SQL subprogram that accepts a parameter of type ORA_FFI.FUNCHANDLETYPE as the first parameter followed by PL/SQL data type equivalents for all other foreign function parameters.
  3. Include a PRAGMA interface in the PL/SQL subprogram.
    The PRAGMA statement invokes the foreign function by passing control to the memory location in Oracle Forms that can communicate with dynamic libraries.

Associating a PL/SQL Subprogram with a Foreign Function Example

Here is an example of associating a subprogram with a foreign function:

PACKAGE BODY calc IS
 /*
  This example shows how to associate a PL/SQL subprogram with
   the given function prototype, int ADD(int X, int Y);
 */

 FUNCTION ff_ADD(ff_handle ORA_FFI.FUNCHANDLETYPE,
  X IN BINARY_INTEGER,
  Y IN BINARY_INTEGER)
  RETURN BINARY_INTEGER;
  PRAGMA interface(C, ff_ADD, 11265);

BEGIN
 ...
END;