Difference between revisions of "DELETE"
Yvonne.milne (Talk | contribs) (→IN |) |
|||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | ''[[DELETE Commands|DELETE ... commands]]'' | ||
+ | |||
==Purpose== | ==Purpose== | ||
Mark records in the active table for deletion | Mark records in the active table for deletion | ||
==Syntax== | ==Syntax== | ||
− | DELETE [<scope>] | + | DELETE |
+ | |||
+ | [IN <workarea>|<alias>] | ||
+ | |||
+ | [<scope>] | ||
[FOR <condition>] | [FOR <condition>] | ||
Line 10: | Line 16: | ||
==See Also== | ==See Also== | ||
− | [[ERASE]], [[LOCATE]], [[PACK]], [[RECALL]], [[SCOPE]], [[SEEK]], [[SET DELETED]], [[SET FILTER]], [[USE]], [[ZAP]] | + | [[ERASE]], [[LOCATE]], [[PACK]], [[RECALL]], [[SCOPE]], [[SEEK]], [[SET DELETED]], [[SET FILTER]], [[SQL DELETE]], [[TRUNCATE TABLE]], [[USE]], [[ZAP]] |
==Description== | ==Description== | ||
The DELETE command marks records in the active table for deletion. Any records which have been marked for deletion with the DELETE command can be reinstated using the [[RECALL]] command. | The DELETE command marks records in the active table for deletion. Any records which have been marked for deletion with the DELETE command can be reinstated using the [[RECALL]] command. | ||
− | Records that are marked for deletion are only physically removed from the table after the PACK command has been issued. If the table is indexed, then | + | Records that are marked for deletion are only physically removed from the table after the PACK command has been issued. If the table is indexed, then Lianja will process the records in the table in the order of the master index file. If the active table is shareable, then Lianja will automatically lock each record in turn, mark it for deletion if required, then unlock the record. |
+ | |||
+ | ====IN <workarea>|<alias>==== | ||
+ | If the workarea number, letter or alias name is specified, the DELETE is carried out in that workarea. Note, the IN clause must be the first clause. From v6.0. | ||
====<scope>==== | ====<scope>==== | ||
Line 40: | Line 49: | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Commands]] | [[Category:Commands]] | ||
− | [[Category:NoSQL | + | [[Category:NoSQL Commands]] |
− | + | ||
− | + | ||
− | + |
Latest revision as of 08:01, 4 January 2021
Contents
Purpose
Mark records in the active table for deletion
Syntax
DELETE
[IN <workarea>|<alias>]
[<scope>]
[FOR <condition>]
[WHILE <condition>]
See Also
ERASE, LOCATE, PACK, RECALL, SCOPE, SEEK, SET DELETED, SET FILTER, SQL DELETE, TRUNCATE TABLE, USE, ZAP
Description
The DELETE command marks records in the active table for deletion. Any records which have been marked for deletion with the DELETE command can be reinstated using the RECALL command.
Records that are marked for deletion are only physically removed from the table after the PACK command has been issued. If the table is indexed, then Lianja will process the records in the table in the order of the master index file. If the active table is shareable, then Lianja will automatically lock each record in turn, mark it for deletion if required, then unlock the record.
IN <workarea>|<alias>
If the workarea number, letter or alias name is specified, the DELETE is carried out in that workarea. Note, the IN clause must be the first clause. From v6.0.
<scope>
The default SCOPE is the current record unless a FOR or WHILE condition is specified.
FOR <condition>
If the FOR clause is specified, then only those records which satisfy the <condition> are deleted. The default SCOPE is ALL.
WHILE <condition>
The WHILE clause can be used to restrict the number of records checked against a particular FOR <condition>, therefore optimizing the deletion process. The default SCOPE is REST.
Example
use patrons index names, events delete all for event = "HAMLET" use patrons index events, names seek "OPERA" delete rest; for date < date(); while event = "OPERA"