J. Notes for Users of QUEL : Delete (QUEL)
 
Share this page                  
Delete (QUEL)
Deletes rows from a database table.
Syntax
[repeat] delete tablename [where qual]
tablename
Specifies the name of the table from which rows are to be deleted. This is a 4GL name.
qual
Specifies a logical expression indicating which rows should be deleted from the table. It cannot contain 4GL names. The qualification function is allowed.
Description
The delete statement removes rows from a table based on the qualification in the where clause, if present. If no qualification is given, the statement deletes all the rows in the table.
Use the qualification function in the where clause.
Store the where clause in a variable. However, in this case, you cannot use the qualification statement.
Queries in which the qualification function is used are not suitable for use as repeated queries. The keyword repeat is ignored if you use it with such queries.
For maximum efficiency, repeat the delete statement, using the repeat option.
Deleting multiple rows from a table based on values from a table field normally involves the use of the unloadtable statement. See Unloadtable.
Examples
Delete all rows in the personnel table containing the employee number (empno) displayed in the current form, using the repeat option:
repeat delete personnel 
  where personnel.empno = empno;
Delete all rows in the Personnel table:
delete personnel;
Delete all rows in the table specified in the tablename field:
delete :tablename;
Delete rows from a table, where the table name and the where clause are expressed as variables:
whereclause = "empno = 12";
tablename = "personnel";
delete :tablename where :whereclause;