DELETE, DELETEU
Synopsis
DELETE filevar,recID [SETTING var] [LOCKED statements] [ON ERROR statements] [THEN statements] [ELSE statements] DELETEU filevar,recID [SETTING var] [LOCKED statements] [ON ERROR statements] [THEN statements] [ELSE statements]
Arguments
filevar | A local variable used as the file identifier of an open MultiValue file. This variable is set by the OPEN statement. |
recID | The record ID of the record to be deleted. |
SETTING var | Optional — When an error occurs, sets the local variable var to the operating system's error return code. Successful completion returns 0; error return codes are platform-specific. The SETTING clause is executed before the ON ERROR clause. Provided for jBASE compatibility. |
Description
The DELETE statement deletes a record from a MultiValue file. The DELETEU statement performs the same operation, but does not release an existing update lock if one was established.
You must use the OPEN statement to open a file before issuing either of these DELETE statements.
You can optionally specify a LOCKED clause, which is executed if DELETE or DELETEU could not delete the specified record due to lock contention. The statements argument can be the NULL placeholder keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line; there must be a line break between the LOCKED keyword and the first line.
You can optionally specify an ON ERROR clause. If record delete fails, the ON ERROR clause is executed. This may occur if the filevar file has already been closed. The statements argument can be the NULL placeholder keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line; there must be a line break between the ON ERROR keyword and the first line.
You can optionally specify a THEN clause, an ELSE clause, or both a THEN and an ELSE clause. If the record delete is successful, the THEN clause is executed. If record delete is attempted but fails, the ELSE clause is executed. The statements argument can be the NULL keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line and cannot follow a THEN, ELSE, or END keyword on that line.
DELETE completes successfully if the recID refers to a non-existent record.
Examples
The following example illustrates the use of the DELETE statement:
OPEN "Myfile.Test" TO myfile
DELETE myfile,myrec ON ERROR PRINT "no delete"