Select Statement
The select statement lets you retrieve data from the database into:
• Simple variables
• Reference variables
• Array variables
If the variable receiving data is associated with a field on a form that is currently displayed, the data is displayed in the field as it is assigned to the variable.
A select statement can retrieve:
A single row
A select statement that retrieves only one row is called a singleton select. The select statement deposits the retrieved data into variables that the program can process as needed.
Multiple rows
When a select statement returns more than one row, only the first row returned is visible to the program. To access the additional rows, use one of the following constructs:
Select loop
A select loop is a block of 4GL statements that are performed on each row returned by the select statement. The loop ends when there are no more rows or an endloop statement is encountered. Select loops are the simplest and often most efficient way to handle multiple rows.
Cursor
A cursor is a row marker that designates an individual row in the select statement's result table (the set of rows returned by a non-singleton select). As the program moves the cursor forward through the result table, you can update or delete the row to which the cursor points and use the values in the row.