External Procedures
External procedures provide a mechanism for calling a nondatabase program (such as a DLL under Windows or a shared library under Unix) from a PL/SQL program. Every session calling an external procedure will have its own extproc process started by the listener. This extproc process is started with the first call to the external procedure and terminates when the session exits. The shared library needs to have a corresponding library created for it in the database.
The following is a brief summary of the steps you need to follow in order to create an external procedure. For details and examples of external procedures, see Chapter 23 in Oracle PL/SQL Programming, 3rd Edition.
Set up the listener.
External procedures require a listener. If you are running an Oracle Net Services listener, that listener can be used as the extproc listener as well, although you may increase security by separating it from the external procedure listener and launching it from an account that has more limited privileges. See the Oracle9i Administrators’ Guide or the Oracle9i Net Services Administrators’ Guide for the details on configuring your listener.
Identify or create the shared library or DLL.
This step has nothing to do with PL/SQL and may or may not have anything to do with the database. You must write your own C routines and link them into a shared library/DLL or use an existing library’s functions or procedures. The simple example shown later will use the existing random number-generating ...