DELETE, DELETEU |
![]() ![]() ![]() |
The DELETE statement deletes a record from an open file. The DELETEU statement is similar but it preserves locks.
Format
DELETE file.var, record.id {ON ERROR statement(s)} DELETEU file.var, record.id {ON ERROR statement(s)}
where
The specified record is deleted from the file. No error occurs if the record does not exist.
If the process performing the DELETE had a read or update lock on the record, the lock is released. The DELETEU statement preserves any lock. Within a transaction, the lock is retained until the transaction terminates and then released regardless of which statement is used. Attempting to delete a record in a transaction will fail if the process does not hold an update lock on the record or the file.
The STATUS() function can be used to determine the cause of execution of the ON ERROR clause. A fatal error occurring when no ON ERROR clause is present will cause an abort to occur.
Example
DELETE STOCK, ITEM.ID
This statement deletes the record whose id is in ITEM.ID from the file associated with file variable STOCK. |