Runtime values as arguments

The statement-local variable (SLV) and host variable types of arguments supply values as the function executes.

Statement-local variables

The parameter list of a UDR can include an OUT keyword that the UDR uses to pass information back to its caller. The following example shows a CREATE FUNCTION statement with an OUT parameter:
CREATE FUNCTION stem(column LVARCHAR, OUT y CHAR)...
In an SQL statement, the argument that corresponds to the OUT parameter is called a statement-local variable, or SLV. The SLV argument appears as a variable name and pound sign (#), as the following example shows:
SELECT...WHERE stem(lname, y # CHAR)

For more information about output parameters, the OUT keyword, and SLVs, see the HCL® Informix® User-Defined Routines and Data Types Developer's Guide.

Host variables

While a client application executes, it can calculate values and pass them to a function as an input parameter. Another name for the input parameter is host variable. In the SQL statement, a question mark (?) represents the host variable, as the following example shows:
SELECT...WHERE equal(lname, ?)
The SET parameter in the following example contains both explicit values and a host variable:
SELECT...WHERE in(SET{'Smith', 'Smythe', ?}, lname)

Because the value of a host variable applies to every row in the table, the access method treats the host variable as a constant. However, the constant that the client application supplies might change during additional scans of the same table. The access method can request that the optimizer re-evaluate the requirements of the qualification between scans.

For more information about the following topics, see the manual indicated.
Topic Manual
Setting values for host variables in client applications HCL® Informix® Enterprise Replication Guide
Using functions from client applications HCL® Informix® DataBlade® API Programmer's Guide
Using host variables in SQL statements HCL® Informix® Guide to SQL: Syntax