Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Format

More

Examples

context-var

on-error

RDB/VMS Relational Database Operator ERASE — VMS RDB_4.0B

 Erases records from a relation.  Before using the ERASE statement,
 you must start a read/write transaction and establish a record stream
 using a context variable with a FOR statement or a START_STREAM
 statement.  You cannot erase records from a view that was formed with
 a WITH, REDUCED, or CROSS clause of an RDO record selection
 expression.  Also, you cannot erase records from a view that was
 formed with a UNION clause of an SQL select expression.

 Example:

     RDO> START_TRANSACTION READ_WRITE RESERVING
     cont>  COLLEGES FOR EXCLUSIVE WRITE
     RDO>     FOR C IN COLLEGES
     cont>      ERASE C
     cont>    END_FOR
     RDO> COMMIT

Additional information available:

FormatMoreExamples

Format

 ERASE ─> context-var ─┬───────>─────┬─>
                       └─> on-error ─┘

Additional information available:

context-varon-error

context-var

 A temporary name specified in an RSE for name recognition.  You must
 define the context variable in a START_STREAM statement or in a FOR
 loop.  Request HELP on RSE for more information.

on-error

 The ON ERROR clause, which specifies a host language statement or
 Rdb/VMS data manipulation statement to be performed if an Rdb/VMS
 error occurs.  Request HELP on ON_ERROR for more information.

More

 You need the Rdb/VMS READ and ERASE privileges to the relation and
 the Rdb/VMS ERASE privilege to the database to use the ERASE
 statement.

 You cannot erase records from a view that was formed with one of the
 following clauses:

  o  WITH clause of an RDO record selection expression

  o  REDUCED TO clause of an RDO record selection expression

  o  CROSS clause of an RDO record selection expression

  o  UNION clause of an SQL select expression

Examples

 Example 1

 Assume you wish to erase all the records in the COLLEGES relation:

 RDO> START_TRANSACTION READ_WRITE RESERVING
 cont>  COLLEGES FOR EXCLUSIVE WRITE
 RDO> FOR C IN COLLEGES ERASE C END-FOR
 RDO> PRINT COUNT OF C IN COLLEGES
  0
 RDO> COMMIT

 This statement uses the loop established by the FOR statement and
 erases all the records from the COLLEGES relation.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026