Was this helpful?
Embedded Usage
Host language variables can be used within expressions in the VALUES clause or in the search condition of the subselect. Variables used in search conditions must denote constant values, and cannot represent names of database columns or include any operators. A host string variable can also replace the complete search condition of the subselect, as when it is used in the forms system query mode. Host language variables that correspond to column expressions can include null indicator variables.
The columns in the subselect must correspond in sequence to the columns into which values are being inserted. For example:
INSERT INTO emps (entryclerk, sicktime, ename)
        SELECT :yourname, 0, newename FROM newemps
In the previous example, the entryclerk column is filled from the form field, yourname, the sicktime column is initialized to 0 using a constant; and the ename column is filled from the names in the newename column of the newemps table.
The VALUES clause can include structure variables that substitute for some or all of the expressions. The structure is expanded by the preprocessor into the names of its individual members; therefore, placing a structure name in the VALUES clause is equivalent to enumerating all members of the structure in the order in which they were declared.
Last modified date: 01/30/2023