J. Notes for Users of QUEL : Retrieve (QUEL) : Using Retrieve Into
 
Share this page                  
Using Retrieve Into
The retrieve into statement is used to create a new table and fill it with rows from other tables in the database that result from a query. One particularly useful application of the retrieve into statement is the creation of a temporary table that can later be used by Report-Writer. Use the following syntax:
retrieve into tablename [unique]
  ([fieldname = expression] | tablename.columnname
  {, [fieldname = expression] |
  tablename.columnname})
[where qual ] 
[sort [by] sortlist ] | [order [by] sortlist ]
[with clause]
The special functions and capabilities of the retrieve statement do not extend to the retrieve into variant. When used within 4GL, retrieve into stands alone as a separate statement. It never appears as a database expression in an assignment statement. It has these additional restrictions:
The retrieve into statement cannot be repeated by the repeat reserved word.
The unique keyword cannot follow the tablename specification; to retrieve unique rows, you must specify a sort by clause.