RDB/VMS SQL DROP — VMS RDB_4.2
Deletes definitions from a database or deletes an entire database.
Additional information available:
CATALOGCOLLATING_SEQUENCECONSTRAINTDATABASE
DOMAININDEXPATHNAMESCHEMASTORAGE_MAPTABLE
TRIGGERVIEW
CATALOG
DROP CATALOG catalog-name ─┬────────────┬──> typebox (;) ├─>
C
A
S
C
A
D
E ─┤ └─>
R
E
S
T
R
I
C
T ┘ catalog-name = ─┬──────> name-of-catalog ────────────┬──> │ │ └─> typebox (") ─> alias.name-of-catalog ─> typebox (") ─┘ Deletes the named catalog.
COLLATING_SEQUENCE
DROP COLLATING SEQUENCE ──> sequence-name; Deletes the named collating sequence. You cannot delete a collating sequence if it is used by the database or by any domain in the database.
CONSTRAINT
Deletes the following types of constraints:
o Constraints defined by the RDO DEFINE CONSTRAINT statement
o Constraints defined with versions of the SQL interface provided
prior to version 3.1 of Rdb/VMS
DROP CONSTRAINT ──> constraint-name ────> typebox (;)
The constraint-name specifies the name of the constraint you want to
delete.
Additional information available:
More Information
The following types of constraints cannot be deleted using DROP
CONSTRAINT:
1. Table-specific constraints defined with the CREATE TABLE
statement of the SQL interface provided with Version 3.1 of
Rdb/VMS.
Use the DROP CONSTRAINT clause of the SQL ALTER TABLE statement
to delete this type of constraint.
2. Relation-specific constraints defined using the RDO DEFINE
RELATION statement provided with Version 3.1 of Rdb/VMS.
Use the DELETE CONSTRAINT clause of the RDO CHANGE RELATION
statement to delete this type of constraint.
DATABASE
DROP DATABASE ──┬─>
A
L
I
A
S alias ───────────┬─> typebox (;) ├─>
F
I
L
E
N
A
M
E file-spec ────┤ └─>
P
A
T
H
N
A
M
E path-name ────┘
Additional information available:
More Informationaliasfile specpath name
More Information
DROP DATABASE deletes a database. When this statement executes, SQL
deletes all the database files associated with the database. If you
specify a CDD path name in the DROP DATABASE statement, SQL also
deletes the CDD directory that contains the database definitions.
NOTE
Use the DROP DATABASE statement with care. You
cannot use ROLLBACK to cancel a DROP DATABASE
statement. When you use this statement, SQL deletes
the physical database file, which includes all data
and all definitions.
alias
The alias of a database that is part of the current session.
file spec
A full or partial file specification that names the database files. If you use a partial file specification, SQL uses the standard VMS defaults. If you use a file specification, DROP DATABASE only deletes database files, whether or not there is also a CDD directory containing database definitions.
path name
A full or relative CDD path name for the dictionary directory where the database definitions are stored. Use a path name instead of a file specification to delete the CDD definitions for the database from the CDD along with the database files.
DOMAIN
DROP DOMAIN ──> domain-name ; Deletes a domain definition. When the DROP DOMAIN statement executes, VAX SQL drops the domain definition from the physical database. If you attached the database using the PATHNAME qualifier, SQL also deletes the domain definition from the CDD$DATABASE definition of the database in the data dictionary. You can drop any named domain once you have attached the database that includes the domain. However, you cannot drop a domain that is referred to in a column definition in a table. If you want to drop a domain that is referred to in a column definition, you must first drop the column definition using the ALTER TABLE statement. If the column definition is used in a constraint or index definition, you must first drop the constraint or index definition, then drop the column definition.
INDEX
DROP INDEX index-name ────> typebox (;) DROP INDEX deletes the specified index definition. When the DROP INDEX statement executes, SQL deletes the index definition from the database. If you attach the database using the PATHNAME qualifier, SQL also deletes the index definition from the CDD$DATABASE definition of the database in the data dictionary. You cannot delete an index definition unless you have attached the database that includes the index. You also cannot delete an index when there are other users who have attached to the same database. You must execute this statement in a READ/WRITE transaction. The index name specifies the name of the index definition you want to delete.
PATHNAME
DROP PATHNAME ──> path-name──> typebox (;) Deletes the data dictionary definitions specified by the pathname argument. It does not delete the physical database files.
SCHEMA
DROP SCHEMA schema-name ─┬────────────┬──> typebox (;) ├─>
C
A
S
C
A
D
E ─┤ └─>
R
E
S
T
R
I
C
T ┘
Additional information available:
More Information
The DROP SCHEMA statement used in earlier versions of SQL is deprecated syntax: use the DROP DATABASE statement to delete the root file and definitions. SQL generates an informational message when you issue a DROP SCHEMA statement, unless you have enabled multischema naming (MULTISCHEMA IS ON) in a previous statement. When multischema naming is enabled, DROP SCHEMA deletes the named schema from a multischema database.
schema name
schema-name = ─┬────────────────────────────────────────┬─┐ ├──────> catalog-name ────────────┬─> . ─┘ │ ├─> typebox (") ─> alias.catalog-name ─> typebox (") ─┘ │ │ ┌──────────────────────────────────────┘ │ └──────────────> name-of-schema ────────┬─> └─> typebox (") ─> alias.name-of-schema ─> typebox (") ─────────┘ The name of the schema or the qualified schema name.
STORAGE_MAP
DROP STORAGE MAP ──> map-name ──> typebox (;)
Additional information available:
More Information
Deletes the specified storage map definition. Do not use the DROP STORAGE MAP and CREATE STORAGE MAP statements to change a storage map. Use the ALTER STORAGE MAP statement instead. You cannot delete a storage map if you have attached the database that includes the storage map. Other users are allowed to be attached to the database when you issue the DROP STORAGE MAP statement. You cannot drop a storage map that refers to a table that has data in it. If you attempt to do so, you will receive an error message. However, you can drop the table once the necessary views and constraints have been dropped, and the underlying storage map will be dropped with the table and its data.
TABLE
DROP TABLE table-name ─┬────────────┬──> typebox (;) ├─>
C
A
S
C
A
D
E ─┤ └─>
R
E
S
T
R
I
C
T ┘
Additional information available:
More Informationtable nameschema name
More Information
DROP TABLE deletes the table definition specified. When the DROP TABLE statement executes, SQL deletes the table definition and the data stored in that table from the database. If you use the PATHNAME qualifier when you declare the database, DROP TABLE also deletes the table definition from the CDD$DATABASE definition of the database in the data dictionary. You must specify the CASCADE keyword if you want SQL to delete all items that refer to the table, and then delete the table. By default, SQL drops only the table (DROP TABLE RESTRICT). If there are views, constraints, triggers, or indexes that refer to the table, the restricted drop fails. You must execute the DROP TABLE statement in a READ WRITE transaction. If you issue this statement when there is no active transaction, SQL starts a transaction with characteristics specified in the most recent DECLARE TRANSACTION statement. You cannot delete a table definition unless you have attached the database that includes the table. Also, you cannot delete a table when there are other active transactions involving the table. That is, you must have exclusive access to the table. If a view definition refers to a table you want to drop, you must drop that view definition before you drop the table. If a constraint in the database references a table, you cannot drop that table until you drop the constraint that references the table.
table name
The name of the table definition you want to delete.
table-name =
─┬────────────────────────┬─> name-of-table ──┬─>
├─┬─> schema-name ─┬> . ─┘ │
│ └─> alias ───────┘ │
└───> typebox (") alias.name-of-table " ───────────────┘
schema name
The name of the schema, which may be used to qualify the table name in a multischema database. schema-name = ─┬────────────────────────────────────────┬─┐ ├──────> catalog-name ────────────┬─> . ─┘ │ ├─> typebox (") ─> alias.catalog-name ─> typebox (") ─┘ │ │ ┌──────────────────────────────────────┘ │ └──────────────> name-of-schema ────────┬─> └─> typebox (") ─> alias.name-of-schema ─> typebox (") ─────────┘
TRIGGER
DROP TRIGGER ─── trigger-name ─────> typebox (;)
Additional information available:
More Information
DROP TRIGGER deletes one trigger definition from the physical database, and if the database is attached with PATHNAME, from the data dictionary. To drop a trigger, you must have DELETE access to the table for which the trigger is defined. You must execute this statement in a read/write transaction. If you issue this statement when there is no active transaction, SQL starts a read/write transaction implicitly. Other users are allowed to be attached to the database when you issue the DROP TRIGGER statement.
trigger name
The name of the trigger you want to delete.
VIEW
DROP VIEW view-name ─┬────────────┬──> typebox (;) ├─>
C
A
S
C
A
D
E ─┤ └─>
R
E
S
T
R
I
C
T ┘ DROP VIEW deletes the specified view definition. When the DROP VIEW statement executes, SQL deletes the view definition from the physical database. If you attach the database using the PATHNAME qualifier, SQL also deletes the view definition from the CDD$DATABASE definition of the database in the data dictionary. You can delete a view definition even when there are active users. Deleting a view definition does not affect active users until you commit your transaction, and they exit their session and declare the database again. You must specify the CASCADE keyword if you want SQL to delete all items that refer to the view, and then delete the view. By default, SQL drops only the view (DROP VIEW RESTRICT). If there are tables, constraints, triggers, or indexes that refer to the view, the restricted drop fails. You must execute this statement in a READ WRITE transaction. If you issue this statement when there is no active transaction, SQL starts a transaction with characteristics specified in the most recent DECLARE TRANSACTION statement.
Additional information available:
view name
The name of the view definition you want to delete.