Contents Index External function prototypes Hiding the contents of procedures, functions, triggers and views

ASA SQL User's Guide
  Using Procedures, Triggers, and Batches
    Calling external libraries from procedures

Passing parameters to external functions


Data types 

The following SQL data types can be passed to an external library:

SQL data type C type
CHAR Character data, with a specified length
VARCHAR Character data, with a specified length
LONG VARCHAR Character data, with a specified length
BINARY Binary data, with a specified length
LONG BINARY Character data, with a specified length
TINYINT 1-byte integer
[ UNSIGNED ] SMALLINT [ Unsigned ] 2-byte integer
[ UNSIGNED ] INT [ Unsigned ] 4-byte integer
[ UNSIGNED ] BIGINT [ Unsigned ] 8-byte integer
VARBINARY Binary data, with a specified length
REAL Single precision floating point number
DOUBLE Double precision floating point number

You cannot use date or time data types, and you cannot use exact numeric data types.

To provide values for INOUT or OUT parameters, use the set_value API function. To read IN and INOUT parameters, use the get_value API function.

Passing NULL 

You can pass NULL as a valid value for all arguments. Functions in external libraries can supply NULL as a return type for any data type.

External function return types 

The following table lists the supported return types, and how they map to the return type of the SQL function or procedure.

C data type SQL data type
void Used for external procedures.
char * function returning CHAR().
long function returning INTEGER
float function returning FLOAT
double function returning DOUBLE.

If a function in the external library returns NULL, and the SQL external function was declared to return CHAR(), then the return value of the SQL extended function is NULL.


Contents Index External function prototypes Hiding the contents of procedures, functions, triggers and views