Skip to content

Delete

See Also: Clear, Find, Open, Zerofile

Purpose

To remove the record currently in the record buffer from each database table named in the command. The DataDictionary class provides superior functionality that replaces the need for this command.

Syntax

Delete {table} [] {table}

Where {table} is the name or filelist number of one or more open database tables. Integer variables may be used as well.

What It Does

The Delete command erases the record that is currently in the record buffer from the database table and removes the entries in associated indexes.

Example

This example deletes the first record in the customer table:

Procedure DeleteFirstCustomer
    Open Customer
    // Get first record.
    Find GE Customer.Recnum
    // Remove the record from the database.
    Delete Customer
    Close Customer
End_Procedure

Notes

  • To delete a record, you must first open its database table and find the record.

  • Delete updates all online indexes, removing entries for the deleted record.

  • Delete only erases one record from each {table}. To erase all the data of an entire database table, leaving only its definition intact, use the Zerofile command.

  • Delete sets the table status to inactive.

  • Delete does not clear the record buffer. All the values that were in the deleted record are still loaded in memory after the Delete command, except for Recnum and RowId.

  • The use of the DataDictionary class can eliminate problems such as deletion of records with relationships in child tables.

  • Once a record has been deleted, it cannot be recovered from the disk.

  • You can pass either the table's DataFlex Name or its table number (in FILELIST.CFG) to the Delete command.