set considerations for SQL

In the context of SQL, you can use the EGL set statement to reset all the fields in an SQL record variable.

Syntax

SQL syntax for set statement
SQLRecordVariable
The name of an SQL record variable whose fields the set statement resets.
value
The value to be assigned to the target SQL record variable. Choose from the following values:
empty
Here the set statement works recursively through any record variables contained within the record, or, in the case of a structured record, works down to the lowest level of the structure. Primitive types have the following settings:
  • Numeric fields are set to zero.
  • Character fields are set to blanks.
  • Date/time fields are set to the current date or time, and INTERVAL fields are set to zero.
  • Fields of type ANY are set according to the type of their current value; if they do not currently have a value, the set statement has no effect on them.
initial
An SQL record variable within a Handler part can specify an initial value for each of its fields. The initial modifier resets the values of those fields to the ones specified in the record definition. If the record definition does not specify any initial values, or if the record is not in a Handler part, the effect of the initial modifier is the same as that of the empty modifier.

Example

The following example clears all fields in the myCustomer customer record variable:
set myCustomer empty;

Feedback