Repeated Queries
An optimizing repeat function is available for the following database query statements: retrieve, append, replace, and delete.
The syntax for repeat queries varies from the standard data manipulation commands only in that the word repeat precedes the command:
repeat retrieve | append | replace | delete command
The optimization scheme is similar to that described for SQL queries.
The following example replaces information about an employee. Each time the query is run, a new employee number is specified, along with data currently on the form.
repeat replace employees (emptbl.all)
where employees.empno = current_empno;
The next example deletes a sample test result. Each time the query is run, a new value for sample number and test result code is used.
repeat delete from results
where results.sample_no = s_no
and results.res_code = rescode;
The following example appends data on the form to the database table customers.
repeat append to customers (custform.all);
You cannot repeat the following types of queries:
• Retrieve into statements
• Queries that use the 4GL qualification function
For example, the following is incorrect:
/* incorrect */
repeat delete employees
where qualification (...);
• Queries that specify table and/or column names or the entire where clause in variables