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

About the PL/SQL Interface

In Oracle Forms, you can invoke a foreign function from a PL/SQL interface using PL/SQL language conventions.

A PL/SQL package encapsulates the components that are used in creating a PL/SQL interface to a foreign function. You can include PL/SQL interfaces to multiple foreign functions in a single PL/SQL package. For each PL/SQL interface to a foreign function, you must follow the procedure of initializing the foreign function, associating a PL/SQL subprogram with the foreign function, and mimicking the foreign function prototype in PL/SQL. Alternatively, you can opt to include a PL/SQL interface to a single foreign function in a PL/SQL package.

Foreign functions invoked from a PL/SQL interface must be contained in a dynamic library. Examples of dynamic libraries include dynamic link libraries on Microsoft Windows, and shared libraries on UNIX systems. The procedure for creating a dynamic library depends on your operating system. For more information on creating dynamic libraries in your environment, refer to the documentation for your operating system.

Creating a PL/SQL interface to foreign functions requires the use of the ORA_FFI Built-in package (Oracle Foreign Function Interface). The ORA_FFI package consists of a group of PL/SQL Built-in subprograms for creating a PL/SQL interface to foreign functions.

By associating a PL/SQL subprogram with a foreign function, you can invoke the foreign function each time you call the associated PL/SQL subprogram. Associating a foreign function with a PL/SQL subprogram is necessary because Oracle Forms uses PL/SQL constructs. The associated PL/SQL subprogram specifies the memory location of the foreign function code to be executed.

Once you have associated a PL/SQL subprogram with a foreign function, Oracle Forms invokes the foreign function whenever you call the PL/SQL subprogram. The associated subprogram requires the first parameter to be a foreign function handle, a parameter type that does not have a host language equivalent in the foreign function prototype.

To provide a PL/SQL interface that has a one-to-one correspondence between the parameter and return data types of the foreign function, you must mimic the prototype of the foreign function using PL/SQL; this is the PL/SQL interface that is made public.

Note: An alternative approach for invoking a foreign function is from a user exit interface. Using a user exit interface to invoke foreign functions occasionally requires relinking Oracle Forms Runform. Because invoking foreign functions from a user exit interface can require relinking Oracle Forms Runform, using a PL/SQL interface provides a looser bind than that of a user exit interface.


About foreign functions

Creating a PL/SQL interface to foreign functions

Invoking a foreign function from a PL/SQL interface

Initializing a foreign function

Associating a PL/SQL subprogram with a foreign function

Mimicking a foreign function prototype with PL/SQL

Foreign function examples