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)...

The VII includes functions to determine whether a qualification function includes an SLV argument and to manage its value. For more information about how the access method intercepts and sets SLVs, refer to the descriptions of the The mi_qual_needoutput() accessor function and The mi_qual_setoutput() accessor function.

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 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 index. 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 Informix ESQL/C Programmer's Manual
Using DataBlade® API functions from client applications Informix DataBlade API Programmer's Guide
Using host variables in SQL statements Informix Guide to SQL: Syntax