Use the DELETE command to remove selected rows from a table.
Options
FROM tblview
Specifies the table or view.
ROWS
This word is optional.
WHERE clause
Limits rows of data. For more information, see WHERE.
WHERE CURRENT OF cursor
Specifies a cursor pointing to the row the DELETE command will remove. This option can replace a standard WHERE clause.
Use the DECLARE CURSOR command to define the cursor.
filespec
Specifies the file to be deleted. Optionally, include a drive and path specification in the form D:\PATHNAME\FILENAME.EXT.
On a workstation with multiple drives (local or mapped), especially when the files are on the different drive, it is always the best practice to define a drive letter when copying, deleting, renaming or running files, unless the specified files are located in the working directory. You will not need to specify the drive letter if all of the files are located in the default directory when using the copy, delete, rename or run commands.
About the DELETE Command
DELETE removes rows from a table or view. Without a WHERE or WHERE CURRENT OF clause, R:BASE deletes all rows from the specified table or view. R:BASE displays a confirmation message before deleting the rows. R:BASE does not display a confirmation message when you execute a DELETE command from a command file. Views must be updatable to delete rows from it; for more information about updatable views, see CREATE VIEW.
Before you use a WHERE clause with the DELETE command, test the clause by using it with a SELECT command, which allows you to view the rows before deleting them.
The WHERE CURRENT OF clause specifies a cursor pointing to a row that the DELETE command will remove. Once you define a cursor with DECLARE CURSOR and open a route with the OPEN command, you can use the cursor in a WHERE CURRENT OF clause to delete only the current row. Use the FETCH command to move the cursor to the next available row.
You must restore deleted rows from a backed up database or table. To recover disk space after deleting rows, use the PACK or RELOAD commands.
DELETE removes rows from a table or single-table view. If you have set transaction processing on, you can restore rows with ROLLBACK. If not, you must restore them from a backup database or table. If you prefer not to use transaction processing, you can first use a relational command, such as PROJECT, to make a backup copy of the table from which you are deleting rows. Then you can delete rows from the original table and remove the backup copy later.
Examples
The following command deletes all rows from the transmastertable. When you omit a WHERE clause, be sure that you want to delete all rows from the table.
DELETE FROM transmaster
The following command deletes rows from the transmaster table where the custid value is 100.
DELETE FROM transmaster WHERE custid = 100