Difference between revisions of "DELETE"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=DELETE=
 
 
 
==Class==
 
Fields and Records
 
 
 
 
==Purpose==
 
==Purpose==
 
Mark records in the active table for deletion
 
Mark records in the active table for deletion
Line 19: Line 12:
  
 
==See Also==
 
==See Also==
[[ERASE]], [[PACK]], [[RECALL]], [[SET DELETED]], [[SET FILTER]], [[ZAP]]
+
[[ERASE]], [[LOCATE]], [[PACK]], [[RECALL]], [[SCOPE]], [[SEEK]], [[SET COMPATIBLE]], [[SET DELETED]], [[SET FILTER]], [[USE]], [[ZAP]]
  
  
 
==Description==
 
==Description==
The DELETE command marks records in the active table for deletion.  The default <scope> deletes the current record.  If the FOR clause is specified, the default scope is ALL.  If the WHILE clause is specified, the default scope is REST.
+
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.
  
If SET FILTER TO <condition> is in effect, then only those records that satisfy the filter are deleted.  If a record is already marked for deletion then the <scope> will be extended.  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 Recital will process the records in the table in the order of the master index file.  If the active table is shareable, then Recital will automatically lock each record in turn, mark it for deletion if required, then unlock the record.
  
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 the Recital/4GL will process the records in the table in the order of the master index file.  If the active table is shareable, then the Recital/4GL will automatically lock each record in turn, mark it for deletion if required, then unlock the record.
+
====<scope>====
 
+
The default [[SCOPE]] is the current record unless a FOR or WHILE condition is specified.
At the end of a DELETE operation with a FOR or WHILE condition, the record pointer is positioned to EOF() if  SET COMPATIBLE TO <XBASE> is in effect.
+
  
 
====FOR <condition>====
 
====FOR <condition>====
If the FOR clause is specified, then only those records which satisfy the <condition> are deleted.  If FOR and WHILE clauses are used at the same time, the default <scope> is ALL.
+
If the FOR clause is specified, then only those records which satisfy the <condition> are deleted.  The default [[SCOPE]] is ALL.
  
 
====WHILE <condition>====
 
====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 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.
  
 +
At the end of a DELETE operation with a FOR or WHILE condition, the record pointer is positioned to EOF() if  SET COMPATIBLE TO <XBASE> is in effect.
  
 
==Example==
 
==Example==
Line 46: Line 39:
 
seek "OPERA"
 
seek "OPERA"
 
delete rest;
 
delete rest;
for date<date();
+
  for date < date();
while event = "OPERA"
+
  while event = "OPERA"
 
</code>
 
</code>
  
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 +
[[Category:Table Basics]]
 +
[[Category:Table Basics Commands]]
 +
[[Category:Data Commands]]

Latest revision as of 16:20, 3 September 2010

Purpose

Mark records in the active table for deletion


Syntax

DELETE [<scope>]

[FOR <condition>]

[WHILE <condition>]


See Also

ERASE, LOCATE, PACK, RECALL, SCOPE, SEEK, SET COMPATIBLE, SET DELETED, SET FILTER, 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 Recital will process the records in the table in the order of the master index file. If the active table is shareable, then Recital will automatically lock each record in turn, mark it for deletion if required, then unlock the record.

<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.

At the end of a DELETE operation with a FOR or WHILE condition, the record pointer is positioned to EOF() if SET COMPATIBLE TO <XBASE> is in effect.

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"


Products

Recital Server, Recital