SQL Statements
External Routine Reference
Use an External Routine Reference when you write an external routine.
Syntax
Usage
The External Routine Reference applies only to external functions and provides the following information about an external routine:
Parameter Style
By default, the parameter style is INFORMIX. If you specify an OUT parameter, the OUT argument is passed by reference.
VARIANT or NOT VARIANT
The VARIANT and NOT VARIANT options apply only to functions. You cannot use VARIANT or NOT VARIANT with procedures.
A variant function does not always return the same value for the same arguments. For example, a function that returns the current date and time or a set of rows from a table is a variant function. In INFORMIX-Universal Server,external functions are variant by default.
A non-variant function always returns the same value when passed the same arguments. To register a non-variant function, add the NOT VARIANT option in the External Routine Reference or in the Routine Modifier clause that is discussed on page 1-1026. If you specify the option in both places, you must use the same option in each.
Example
The following example registers an external function named equal() that takes two values of point data type as arguments. In this example, point is an opaque type that specifies the x and y coordinates of a two-dimensional point.
The function returns a single value of type BOOLEAN. The external name specifies the path to the C shared library where the object code of the function is stored. The external name indicates that the library contains another function, point1_equal, which is invoked while equal(point, point) is executing.
References
In this manual, see the CREATE FUNCTION and CREATE PROCEDURE statements.
For information about how to create and register external routines, see the Extending INFORMIX-Universal Server: User-Defined Routines manual.
Function Name
The Function Name segment specifies the name of a function.
Syntax
Usage
In a statement that calls for a Function Name, you can enter an identifier with an optional owner name, database name, and server name. The database and server names allow you to use a function stored on a remote database. A function name with a database name, server name, and owner name is called a fully qualified function name.
The actual name of the function is an SQL identifier.
The owner name is case sensitive. In an ANSI database, if you type quotation marks around the name, it is stored as you type it. If you do not use quotation marks, the name is stored as uppercase letters. For more information, see the discussion of case sensitivity in ANSI-compliant databases on page 1-1049. 
If you are using a nondefault locale, you can use characters from the code set of your locale in the names of functions. For more information, see the Guide to GLS Functionality. 
Routine Overloading
Due to routine overloading, a function name does not need to be unique in INFORMIX-Universal Server. You can define more than one function with the same name and different parameter lists.
Functions are uniquely identified by their signature. A function's signature includes the following items:
If a function name is not unique, Universal Server uses routine resolution to identify the instance of the function to execute. For information about routine resolution, see the Extending INFORMIX-Universal Server: User-Defined Routines manual.
Qualified Function Name
When you add the database name and server name options, you use a fully qualified function name to specify a remote function. You can use those options under the following conditions:
References
In this manual, see the CALL, CREATE FUNCTION, DROP FUNCTION, DROP ROUTINE, and EXECUTE FUNCTION statements.
For information about how to create and use external routines, see the Extending INFORMIX-Universal Server: User-Defined Routines manual. In the Informix Guide to SQL: Tutorial, see Chapter 14 for information about how to create and use SPL routines.
|