Language basics / Variables |
The INITIALIZE instruction intializes program variables with NULL or default values.
INITIALIZE target [,...] { TO NULL | LIKE {table.*|table.column} }
The INITIALIZE instruction assigns NULL or default values to variables.
The argument of the INITIALIZE instruction can be a simple variable, a record (with .* notation), a record member, a range of record members specified with the THRU keyword, an array or an array element.
The TO NULL clause initializes the variable to null.
When initializing a static array TO NULL, all elements will be initialized to null. When initializing a dynamic array TO NULL, all elements will be removed (i.e. the dynamic array is cleared).
The LIKE clause initializes the variable to the default value defined in the database schema validation file. This clause works only by specifying the table.column schema entry corresponding to the variable.
INITIALIZE record.* LIKE table.*
You cannot initialize variables defined with a complex data type (like TEXT or BYTE) to a non-NULL value.
SCHEMA stores MAIN DEFINE cr RECORD LIKE customer.* DEFINE a1 ARRAY[100] OF INTEGER INITIALIZE cr.cust_name TO NULL INITIALIZE cr.cust_name THRU cr.cust_address TO NULL INITIALIZE cr.* LIKE customer.* INITIALIZE a1 TO NULL INITIALIZE a1[10] TO NULL END MAIN