Creating procedures and functions with external calls
Syntax
This section describes how to use the external library calls in procedures.
Warning!
External libraries can corrupt your database.
External libraries called from procedures share the memory of the server. If you
call a DLL from a procedure and the DLL contains memory-handling errors,
you can crash the server or corrupt your database. Ensure that your libraries are
thoroughly tested before deploying them on production databases.
This section presents some examples of procedures and functions with external
calls.
For a full description of the CREATE PROCEDURE statement syntax, see
"CREATE PROCEDURE statement" in Adaptive Server IQ Reference
Manual.
For a full description of the CREATE FUNCTION statement syntax for
external calls, see "CREATE FUNCTION statement" in Adaptive Server IQ
Reference Manual.
Note
You must have DBA permissions in order to create external procedures
or functions. This requirement is more strict than the RESOURCE permissions
required for creating other procedures or functions.
A procedure that calls a function function_name in DLL library.dll can be
created as follows:
CREATE PROCEDURE dll_proc ( parameter-list )
EXTERNAL NAME 'function_name@library.dll'
Such a procedure is called an external stored procedure. If you call an
external DLL from a procedure, the procedure cannot carry out any other tasks;
it just forms a wrapper around the DLL.
An analogous CREATE FUNCTION statement is as follows:
CREATE FUNCTION dll_func ( parameter-list )
RETURNS data-type
EXTERNAL NAME 'function_name@library.dll'
CHAPTER 6
Using Procedures and Batches
269
Need help?
Do you have a question about the Adaptive Server IQ 12.4.2 and is the answer not in the manual?
Questions and answers