Difference between revisions of "SQL DELETE"

From Recital Documentation Wiki
Jump to: navigation, search
(Description)
Line 13: Line 13:
  
 
==Description==
 
==Description==
The DELETE command executes an immediate physical deletion of the specified records i.e., records are permanently removed from the table, and cannot be recalled.
+
For third-party gateway databases, the DELETE command executes an immediate physical deletion of the specified records i.e., records are permanently removed from the table, and cannot be recalled.  For native tables, it works in the same way as the Recital [[DELETE]] command, marking the record for deletion.
  
 
To perform a DELETE operation you must have the DELETE privilege or be the owner of the table.
 
To perform a DELETE operation you must have the DELETE privilege or be the owner of the table.
Line 32: Line 32:
 
|-
 
|-
 
|}
 
|}
 
  
 
==Example==
 
==Example==

Revision as of 15:24, 15 March 2012

Purpose

Deletes one or more rows from a table


Syntax

DELETE FROM [<database>!]<table>

[WHERE CURRENT OF <cursor> | <condition>]

See Also

ADD TABLE, CLOSE, CREATE DATABASE, DB_DATADIR, DECLARE CURSOR, DROP CURSOR, EXECUTE IMMEDIATE, FETCH, GETENV(), INSERT, OPEN, OPEN DATABASE, SET AUTOCATALOG, UPDATE, USE


Description

For third-party gateway databases, the DELETE command executes an immediate physical deletion of the specified records i.e., records are permanently removed from the table, and cannot be recalled. For native tables, it works in the same way as the Recital DELETE command, marking the record for deletion.

To perform a DELETE operation you must have the DELETE privilege or be the owner of the table.


Keywords Description
database The name of the database to which the table belongs. Databases in Recital are implemented as directories containing files that correspond to the tables and associated files in the database. Operating System file protection can be applied individually to the files for added security. The directory is a sub-directory of the Recital data directory. The environment variable DB_DATADIR points to the current Recital data directory and can be queried using the GETENV() function. Files from other directories can be added to the database using the ADD TABLE command or via the database catalog and SET AUTOCATALOG functionality. The '!' character must be included between the database name and the table name.
table The name of the table from which to delete the rows.
WHERE Specifies which rows are to be deleted.
CURRENT OF cursor Deletes only the row most recently fetched by the cursor.
condition Deletes only the rows that satisfy the condition.

Example

DELETE FROM staff WHERE ord_date < date()


Products

Recital Server, Recital