Deletes records from the current table.


[FOR <condition 1>]
[WHILE <condition 2>]

FOR <condition 1>
WHILE <condition 2>

The scope of the command. The default scope is NEXT 1, the current record only.


DBF tables support the concept of soft deletes, where the record is marked as deleted and normally hidden when SET DELETED is ON (the default). If you SET DELETED OFF, you can see the deleted records along with the records that are not marked as deleted. You can RECALL the record to undelete it. To actually remove the record from the table, you must PACK the table. If you use the LIST or DISPLAY commands to display records, records marked as deleted are displayed with an asterisk.

For other table types, when you delete a record, it is removed from the table and cannot be recovered. (Some tables still require you to perform a maintenance operation on the table to reclaim the unused space. For more information, refer to your database server documentation.)

Relying on soft deletes to be able to recover information from deleted records is not recommended. This technique does not scale well to other databases, because they donít support soft deletes. If you want to make data available for recover, consider using an identically-structured purge table that stores copies of the records that you have deleted.

Soft deletes are useful when you want to recycle deleted records. This obviates the need to PACK the table. You BLANK the record before you DELETE it. Then whenever you need to add a new record, you can search for a deleted record and reuse it.

To delete all records from a table, use ZAP.


Use the Rowset objectís delete(†) method. There is no support for soft deletes; if you delete(†) a row in a DBF table, there is no corresponding dBL method that will recall it. You may still use the RECALL command.