%ListBind meta-SQL element
Syntax
%ListBind({FIELD_LIST | FIELD_LIST_NOLONGS | KEY_FIELDS},recordname [State_record_alias])
Description
The %ListBind meta-SQL construct expands a field list as bind references for use in an Insert/Value statement.
Note:
This meta-SQL is not implemented for COBOL, dynamic view SQL, or PeopleCode.
Parameters
| Parameter | Description |
|---|---|
|
FIELD_LIST |
Use all field names in a record. You can select only one option from FIELD_LIST, FIELD_LIST_NOLONGS, or KEY_FIELDS. |
|
FIELD_LIST_NOLONGS |
Use all field names in a record, except any long columns (long text or image fields). You can select only one option from FIELD_LIST, FIELD_LIST_NOLONGS, or KEY_FIELDS. |
|
KEY_FIELDS |
Use all key field names in a record. You can select only one option from FIELD_LIST, FIELD_LIST_NOLONGS, or KEY_FIELDS. |
|
recordname |
Identify either a record or a subrecord that the field names are drawn from. This can be a bind variable, a record object, or a record name in the form recname. You cannot specify RECORD.recname, a record name in quotation marks, or a table name. |
|
State_record_alias |
Specify the Application Engine state record buffer that contains the values (this could be different than the record used to derive the field list). If missing, the default state record is assumed. |
Example
INSERT INTO PS_TARGET (FIELD1, FIELD2, %List(FIELD_LIST, CF_SUBREC), FIELDN)⇒
VALUES (%Bind(MY_AET.FIELD1), %Bind(MY_AET.FIELD2), %ListBind(FIELD_LIST, CF_⇒
SUBREC MY_AET), %Bind(MY_AET.FIELDN))
Considerations for Using %ListBind
When using %ListBind in an insert/select or insert/values or %Select statement, you must have matching pairs of %List or %ListBind in the target and source field lists, using the same list type argument and record name to ensure consistency.