


There are three possibilities of formulating SQL statements in SQL-PL.
1. The SQL statement does not contain any SQL variables.
Example:

2. The SQL statement contains SQL variables or position indicators for SQL variables. At execution time a variable or an expression is assigned as current value to each position indicator.
Example:

3. The SQL statement generated at runtime contains position indicators for input and output variables. The values or variables to replace them are to be read and checked for validity by the program. First a name is assigned to the SQL statement by means of the SQL PREPARE statement. Then the description of the SQL variables is found out by means of the SQL DESCRIBE statement. Validity checks can be made on the basis of such a description. Finally the SQL statement is executed by means of the SQL EXECUTE satement.
Example:

Note:
In the last example the SQL DESCRIBE statement produces in 'descrip(1)' the value 'IN CHAR(20) BYTE NOT NULL' as description of the variable 'name'.
Syntax:



