RDB/VMS SQL ALTER — VMS SQLdev_2.0
Changes definitions for VAX SQL.
Additional information available:
DOMAININDEXSCHEMASTORAGE_MAPTABLE
DOMAIN
ALTER DOMAIN domain-name ─┬─────────────────┬─┐ └─> typebox (I)typebox (S) data-type ─┘ │ ┌─────────────────────────────────────────────┘ └─┬───────────────────────────┬──> typebox (;) └─┬─> sql-and-dtr-clause ─┬─┘ └────── <───────────────┘
Additional information available:
More Informationsql and dtr clause
More Information
Alters a domain definition. This allows you to change the data type or SQL and DATATRIEVE formatting parameters for all columns defined using the domain, simply by changing the domain itself. For example, if you want to change the data type for EMPLOYEE_ID from CHAR(5) to CHAR(6), you need only alter the data type for ID_DOM. You do not have to alter the data type for the column EMPLOYEE_ID in the tables DEGREES, EMPLOYEES, JOB_HISTORY, SALARY_HISTORY, nor do you have to alter the column MANAGER_ID in DEPARTMENTS. You can alter any named domain once you have declared the schema that includes the domain. If you want to alter a domain that is referred to in an index definition, you must first drop the index. If a domain definition is stored in the data dictionary, the ALTER DOMAIN statement alters the domain definition in the data dictionary.
sql and dtr clause
sql-and-dtr-clause = ─┬─>
Q
U
E
R
Y
H
E
A
D
E
R typebox (I)typebox (S) ─┬> quoted-string ──┬─────────────────┬─> │ └────── typebox (/) <────────┘ │ ├─>
E
D
I
T
S
T
R
I
N
G typebox (I)typebox (S) quoted-string ─────────────────────────┤ │ │ ├─>
Q
U
E
R
Y
N
A
M
E Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) quoted-string ─┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─>
D
E
F
A
U
L
T
V
A
L
U
E Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) literal ────┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─>
N
O
Q
U
E
R
Y
H
E
A
D
E
R ──────────────────────────────────────┤ ├─>
N
O
E
D
I
T
S
T
R
I
N
G ───────────────────────────────────────┤ ├─>
N
O
Q
U
E
R
Y
N
A
M
E ────┬──> Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─────────┘ └─>
N
O
D
E
F
A
U
L
T
V
A
L
U
E ─┘ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ Optional formatting clauses allow you to modify data displays or query characteristics for interactive SQL users and DATATRIEVE users. A query header specifies a string that interactive SQL or DATATRIEVE displays in place of the column name when it retrieves values from a column. An edit string specifies a string that controls how interactive SQL or DATATRIEVE formats the display of values in a column. DEFAULT VALUE and QUERY NAME are active only from DATATRIEVE.
INDEX
ALTER INDEX index-name ─┐ ┌───────────────────────┘ └─┬────────────────────────────────┬─┬───────────────────────┬─> typebox (;) └┬┬─>
N
O
D
E
S
I
Z
E number-bytes ──┬┬┘ └─> index-store-clause ─┘ │├─>
P
E
R
C
E
N
T
F
I
L
L percentage ─┤│ │└─>
U
S
A
G
E ─┬─>
U
P
D
A
T
E ─┬─────┘│ │ └─>
Q
U
E
R
Y ──┘ │ └─────────────── <─────────────┘
Additional information available:
More Information
Changes an index. The ALTER INDEX statement allows you to change:
o The characteristics of index nodes (sorted indexes only)
o The names of the storage area or storage areas that contain the
index
You cannot change:
o The columns that comprise an index
o Whether the index is UNIQUE
o A hashed to a sorted index
o A sorted index to a hashed index
You cannot alter an index when there are other active users of the
database.
store clause
store-clause = STORE ─┐ ┌─────────────────────┘ ├─>
I
N area-name ─────────────────────────────────────────────────┬─> ├─>
R
A
N
D
O
M
L
Y
A
C
R
O
S
S ─> ( ─┬─> area-name ─┬─> ) ───────────────────┤ │ └───── , <─────┘ │ └─>
U
S
I
N
G ─> ( ─┬─> column-name ─┬─> ) ─┐ │ └────── , <──────┘ │ │ ┌──────────────────────────────────────┘ │ └┬─>
I
N area-name WITH LIMIT OF ─> ( ─┬─ literal ─┬─> ) ─┬─┐ │ │ └──── , <───┘ │ │ │ └────────────────────────── <───────────────────────────┘ │ │ ┌──────────────────────────────────────────────────────────┘ │ └─>
O
T
H
E
R
W
I
S
E typebox (I)typebox (N) area-name ──────────────────────────────────────┘
Additional information available:
More Information
A storage map definition for the index. You can specify a store clause for indexes in a multifile schema only. The STORE clause allows you to specify which storage area files will be used to store the index entries.
SCHEMA
ALTER SCHEMA ─┬─>
P
A
T
H
N
A
M
E path-name ─┬┐ └─>
F
I
L
E
N
A
M
E file-spec ─┘│ ┌──────────────────────────────────────┘ └─> alter-root-file-params ──> alter-storage-area-params ──┐ ┌─────────────────────────── <─────────────────────────────┘ └─┬─┬───────────────────────────────────────────────────────────┬─┬─> typebox (;) │ ├─>
A
D
D
S
T
O
R
A
G
E
A
R
E
A area-name ─┬───────────> ──────────┬─┐ │ │ │ │ └─>
F
I
L
E
N
A
M
E file-spec ─┘ │ │ │ │ │ ┌─────────────────────── <────────────────────────────┘ │ │ │ │ └─> storage-area-params ────────────────────────────────┤ │ │ ├─>
A
L
T
E
R
S
T
O
R
A
G
E
A
R
E
A area-name alter-storage-area-params ─┤ │ │ └─>
D
R
O
P
S
T
O
R
A
G
E
A
R
E
A area-name ────────────────────────────┘ │ └───────────────────────────── <────────────────────────────────┘
Additional information available:
ADD_STORAGE_AREAALTER_STORAGE_AREADROP_STORAGE_AREA
alter root file paramsalter storage area paramsMore Informationstorage area params
ADD_STORAGE_AREA
Specifies the name and file specification for a storage area you want to add to the schema. You can use the ADD STORAGE AREA clause only on multifile databases. The area name cannot be the same as any other storage area definition in the schema. The ADD STORAGE AREA clause creates two files, a data file with a file extension of .RDS and a snapshot file with a file extension of .SNP. If you omit the FILENAME argument, the file specification takes the following defaults: o Device: the current device for the process o Directory: the current device for the process o File name: the name specified for the storage area The file specification is used for both the data and snapshot files that comprise the storage area (unless you use the SNAPSHOT FILENAME argument to specify a different file for the snapshot file). Because the ADD STORAGE AREA clause may create two files with different file extensions, do not specify a file extension with the file specification.
ALTER_STORAGE_AREA
Specifies the name of an existing storage area in the schema that you want to alter. You can use the ALTER STORAGE AREA clause only on multifile databases. The alter-storage-area-params are parameters that the ALTER STORAGE AREA clause changes.
alter root file params
alter-root-file-params = ─┬─┬─────────────────────────> ─────────────────────────────┬─┬──> │ ├─>
O
P
E
N typebox (I)typebox (S) ──────────┬──>
A
U
T
O
M
A
T
I
C ─┬───────────────┤ │ │ │ └──>
M
A
N
U
A
L ─────┘ │ │ │ ├─>
N
U
M
B
E
R typebox (O)F
U
S
E
R
S typebox (I)typebox (S) ──> number-users ─────────────────┤ │ │ ├─>
N
U
M
B
E
R typebox (O)F
B
U
F
F
E
R
S typebox (I)typebox (S) ─────> number-buffers ──────────┤ │ │ ├─>
N
U
M
B
E
R typebox (O)F
V
A
X
C
L
U
S
T
E
R
N
O
D
E
S typebox (I)typebox (S) ──> number-nodes ──────┤ │ │ ├─>
N
U
M
B
E
R typebox (O)F
R
E
C
O
V
E
R
Y
B
U
F
F
E
R
S typebox (I)typebox (S) ──> number-buffers ────┤ │ │ ├─>
S
N
A
P
S
H
O
T typebox (I)typebox (S) ──┬─>
E
N
A
B
L
E
D ─┬─>
I
M
M
E
D
I
A
T
E ─┬─┬────────┤ │ │ │ │ └─>
D
E
F
E
R
R
E
D ──┘ │ │ │ │ │ └─>
D
I
S
A
B
L
E
D ────────>────────┘ │ │ │ ├─>
D
I
C
T
I
O
N
A
R
Y typebox (I)typebox (S) ──────┬─>
R
E
Q
U
I
R
E
D ───────┬────────────┤ │ │ │ └─>
N
O
T
R
E
Q
U
I
R
E
D ───┘ │ │ │ ├─>
A
D
J
U
S
T
A
B
L
E
L
O
C
K
G
R
A
N
U
L
A
R
I
T
Y typebox (I)typebox (S) ─┬─>
E
N
A
B
L
E
D ──┬──────┤ │ │ │ └─>
D
I
S
A
B
L
E
D ─┘ │ │ │ ├─>
J
O
U
R
N
A
L
F
I
L
E
N
A
M
E file-spec ──────────────────────────┤ │ │ ├─>
J
O
U
R
N
A
L
A
L
L
O
C
A
T
I
O
N typebox (I)typebox (S) ─> journal-blocks ─> typebox (B)typebox (L)typebox (O)typebox (C)typebox (K)typebox (S) ───┤ │ │ ├─>
J
O
U
R
N
A
L
E
X
T
E
N
T typebox (I)typebox (S) ───> extent-blocks ──> typebox (B)typebox (L)typebox (O)typebox (C)typebox (K)typebox (S) ─────┤ │ │ └─>
N
O
J
O
U
R
N
A
L ──────────────────────────────────────────┘ │ └───────────────────────────── <─────────────────────────────┘
Additional information available:
More Information
Parameters that control the characteristics of the database root file associated with the schema, or characteristics stored in the root file that apply to the entire database. You can specify these parameters for either single-file or multifile databases. Note that ALTER SCHEMA does not allow you to change all root file parameters you can specify in CREATE SCHEMA. You must use the EXPORT and IMPORT statements to change the following root file parameters: o BUFFER SIZE o SEGMENTED STRING STORAGE AREA
alter storage area params
alter-storage-area-params = ─┬─┬─────────────────────────> ─────────────────────────────┬─┬──> │ ├─>
E
X
T
E
N
T typebox (I)typebox (S) ────────┬──> extent-pages ─> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ──┬────┤ │ │ │ └──> (extension-options) ─────┘ │ │ │ ├─>
S
N
A
P
S
H
O
T
A
L
L
O
C
A
T
I
O
N typebox (I)typebox (S) ─> snp-pages ──> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ───────┤ │ │ └─>
S
N
A
P
S
H
O
T
E
X
T
E
N
T typebox (I)typebox (S) ─┬─> extent-pages ─> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ─┬─────┘ │ │ └─> (extension-options) ───┘ │ └───────────────────────────── <─────────────────────────────┘
Additional information available:
More Informationextension options
More Information
Parameters that change the characteristics of database storage area
files. You can specify the same storage area parameters for either
single-file or multifile databases, but the effect of the clauses in
this part of an ALTER SCHEMA statement differs:
o For single-file databases, the storage area parameters change the
characteristics for the single storage area in the schema
o For multifile databases, the storage area parameters change the
characteristics of the RDB$SYSTEM storage area. SQL generates an
error if you specify RDB$SYSTEM as the area name in the ALTER
STORAGE AREA clause, so specifying the parameters in this part of
the ALTER SCHEMA statement is the only way to change the
parameters of the RDB$SYSTEM storage area using ALTER SCHEMA.
Note that ALTER SCHEMA does not allow you to change all storage area
parameters you can specify in CREATE SCHEMA. You must use the EXPORT
and IMPORT statements to change the following root file parameters:
o ALLOCATION
o PAGE SIZE
o PAGE FORMAT
o THRESHOLDS
o INTERVAL
o SNAPSHOT FILENAME
extension options
extension-options = ──> (
M
I
N
I
M
U
M typebox (O)F min-pages PAGES, ─┐ ┌──────────────────────────────────┘ └─>
M
A
X
I
M
U
M typebox (O)F max-pages PAGES, ┐ ┌───────────────────────────────┘ └─>
P
E
R
C
E
N
T
G
R
O
W
T
H typebox (I)typebox (S) growth ) ──> Changes the number of pages of each snapshot or storage area file extent.
DROP_STORAGE_AREA
Deletes the specified storage area definition and the associated data and snapshot files. You can use the DROP STORAGE AREA clause only on multifile databases. To protect against accidental data deletion, the ALTER SCHEMA statement fails if you specify a DROP STORAGE AREA clause that names a storage area referred to in any storage map. You must first use the ALTER STORAGE MAP statement to move the data to another storage area.
More Information
Alters a schema in any of the following ways:
o For both single-file and multifile databases, changes
characteristics of the database root file associated with a
schema. ALTER SCHEMA allows you to override certain
characteristics specified in the root file parameters of a CREATE
SCHEMA statement, such as whether a snapshot file is disabled.
In addition, ALTER SCHEMA lets you control other characteristics
you cannot specify in CREATE SCHEMA root file parameters, such as
whether after-image journaling is enabled.
o For both single-file and multifile databases, changes storage
area parameters.
o For multifile databases only, adds, alters, or drops storage
areas.
storage area params
storage-area-params = ─┬─┬──────────────────────────>─────────────────────────────┬─┬──> │ ├─>
A
L
L
O
C
A
T
I
O
N typebox (I)typebox (S) ───> number-pages ────> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ─────────┤ │ │ ├─>
P
A
G
E
S
I
Z
E typebox (I)typebox (S) ────> page-blocks ─────> typebox (B)typebox (L)typebox (O)typebox (C)typebox (K)typebox (S) ────────┤ │ │ ├─>
P
A
G
E
F
O
R
M
A
T typebox (I)typebox (S) ──┬────>
U
N
I
F
O
R
M ────┬────────────────┤ │ │ │ └────>
M
I
X
E
D ──────┘ │ │ │ ├─>
T
H
R
E
S
H
O
L
D
S typebox (A)typebox (R)typebox (E) ( val1 ─┬──────────────────────┬─> ) ─┤ │ │ │ └─> ,val2 ─┬──────────┬┘ │ │ │ │ └─> ,val3 ─┘ │ │ │ ├─>
I
N
T
E
R
V
A
L typebox (I)typebox (S) ───────> number-data-pages ──────────────┤ │ │ ├─>
E
X
T
E
N
T typebox (I)typebox (S) ────┬──> extent-pages ────> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ────┬────┤ │ │ │ └──> (extension-options)──────────┘ │ │ │ ├─>
S
N
A
P
S
H
O
T
F
I
L
E
N
A
M
E ───> file-spec ────────────────────┤ │ │ ├─>
S
N
A
P
S
H
O
T
A
L
L
O
C
A
T
I
O
N typebox (I)typebox (S) ──> snp-pages ──> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ──────┤ │ │ └─>
S
N
A
P
S
H
O
T
E
X
T
E
N
T typebox (I)typebox (S) ─┬─> extent-pages ──> typebox (P)typebox (A)typebox (G)typebox (E)typebox (S) ─┬────┘ │ │ └─> (extension-options) ────┘ │ └─────────────<─────────────────────────────────────<────────┘ Parameters that control the characteristics of the storage area.
STORAGE_MAP
ALTER STORAGE MAP map-name ─┐ ┌───────────────────────────┘ └─┬─┬─> store-clause ─────────────────────┬─┬─> typebox (;) │ ├─>
P
L
A
C
E
M
E
N
T
V
I
A
I
N
D
E
X index-name ───┤ │ │ └─┬─>
E
N
A
B
L
E ──┬─>
C
O
M
P
R
E
S
S
I
O
N ───────┘ │ │ └─>
D
I
S
A
B
L
E ─┘ │ └─────────────────── <────────────────────┘
Additional information available:
More Information
Changes an existing storage map. A storage map controls which rows
of a table are stored in which storage areas in a multifile database.
In addition to changing storage maps, ALTER STORAGE MAP has options
that change:
o Which index the database system uses when inserting rows in the
table
o Whether the rows of the table will be stored in a compressed
format
store clause
store-clause = STORE ─┐ ┌─────────────────────┘ ├─>
I
N area-name ─────────────────────────────────────────────────┬─> ├─>
R
A
N
D
O
M
L
Y
A
C
R
O
S
S ─> ( ─┬─> area-name ─┬─> ) ───────────────────┤ │ └───── , <─────┘ │ └─>
U
S
I
N
G ─> ( ─┬─> column-name ─┬─> ) ─┐ │ └────── , <──────┘ │ │ ┌──────────────────────────────────────┘ │ └┬─>
I
N area-name WITH LIMIT OF ─> ( ─┬─ literal ─┬─> ) ─┬─┐ │ │ └──── , <───┘ │ │ │ └────────────────────────── <───────────────────────────┘ │ │ ┌──────────────────────────────────────────────────────────┘ │ └─>
O
T
H
E
R
W
I
S
E typebox (I)typebox (N) area-name ──────────────────────────────────────┘
Additional information available:
More Information
A new storage map definition that replaces the existing storage map.
The store clause allows you to specify which storage area files will
be used to store rows from the table:
o All rows of a table can be associated with a single storage area.
o Rows of a table can be randomly distributed among several storage
areas.
o Rows of a table can be systematically distributed, or
partitioned, among several storage areas by specifying upper
limits on the values for a column in a particular storage area.
TABLE
ALTER TABLE ──> table-name ──┐ ┌────────────────────────────┘ └─┬─┬─>
A
D
D ─┬─> typebox (C)typebox (O)typebox (L)typebox (U)typebox (M)typebox (N) add-col-definition ─────────┬──> typebox (;) │ │ └─>
C
O
N
S
T
R
A
I
N
T check-table-constraint ─┤ │ ├─>
A
L
T
E
R alter-col-definition ─────────────────┤ │ └─>
D
R
O
P ─┬─> typebox (C)typebox (O)typebox (L)typebox (U)typebox (M)typebox (N) column-name ───────────────┤ │ └─>
C
O
N
S
T
R
A
I
N
T constraint-name ───────┤ └──────────────────── <───────────────────────────┘ check-table-constraint = ──>
C
H
E
C
K (predicate) ─┬───────────────────────────────┬─> └─>
D
I
A
G
N
O
S
T
I
C constraint-name ─┘ The ALTER TABLE statement adds, modifies, or deletes columns in a base table.
Additional information available:
ADD_COLUMNADD_CONSTRAINTALTER_COLUMNDROP_COLUMN
DROP_CONSTRAINT
ADD_COLUMN
The ADD COLUMN clause creates an additional column in the table. SQL
adds the column to the right of the existing columns in the table.
add-col-definition =
──> column-name ─┬─> data-type ───┬┬┬──────────>──────────────┬┬─>
└─> domain-name ─┘│├─> check-col-constraint ─┤│
│└─> sql-and-dtr-clause ───┘│
└───────────<───────────────┘
check-col-constraint =
─>
C
H
E
C
K (predicate) ──┬───────────────────────────────┬─>
└─>
D
I
A
G
N
O
S
T
I
C constraint-name ─┘
Specify a name for the column, a data type or domain, and,
optionally, a check column constraint and formatting and DATATRIEVE
clauses.
Additional information available:
data typescheck col constraintsql and dtr clause
data types
data-type = ──┬─>
C
H
A
R ─┬────────┬───────────────────────────┬──> │ └─> (n) ─┘ │ ├─>
V
A
R
C
H
A
R (n) ───────────────────────────────┤ ├─>
L
O
N
G
V
A
R
C
H
A
R ──────────────────────────────┤ ├─>
S
M
A
L
L
I
N
T ──┬─┬────────┬────────────────────┤ ├─>
I
N
T
E
G
E
R ───┤ └─> (n) ─┘ │ ├─>
Q
U
A
D
W
O
R
D ──┘ │ ├─>
D
E
C
I
M
A
L ─┬─┬─────────────────────────────┬─┤ ├─>
N
U
M
E
R
I
C ─┘ └─> ( ──> n ─┬────────┬─> ) ──┘ │ │ └─> , n ─┘ │ ├─>
F
L
O
A
T ─┬────────┬──────────────────────────┤ │ └─> (n) ─┘ │ ├─>
R
E
A
L ──────────────────────────────────────┤ ├─>
D
O
U
B
L
E
P
R
E
C
I
S
I
O
N ──────────────────────────┤ └─>
D
A
T
E ──────────────────────────────────────┘
check col constraint
The CHECK (predicate) clause creates a CHECK column constraint definition associated with the column. A CHECK constraint specifies a predicate that column values inserted into the table must satisfy. Predicates in CHECK column constraints can refer only to the column with which they are associated. The DIAGNOSTIC clause specifies a name for the constraint. The name is used in error messages and ALTER TABLE DROP CONSTRAINT, SHOW TABLE, DECLARE TRANSACTION and SET TRANSACTION statements. The DIAGNOSTIC clause is optional. If you omit the constraint name, SQL creates a name. However, DIGITAL recommends that you always name column and table constraints. The constraint names generated by SQL may be obscure and, in programs, may change between compilation and running.
sql and dtr clause
sql-and-dtr-clause = ─┬─>
Q
U
E
R
Y
H
E
A
D
E
R typebox (I)typebox (S) ─┬> quoted-string ──┬─────────────────┬─> │ └────── typebox (/) <────────┘ │ ├─>
E
D
I
T
S
T
R
I
N
G typebox (I)typebox (S) quoted-string ─────────────────────────┤ │ │ ├─>
Q
U
E
R
Y
N
A
M
E Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) quoted-string ─┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─>
D
E
F
A
U
L
T
V
A
L
U
E Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) literal ────┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─>
N
O
Q
U
E
R
Y
H
E
A
D
E
R ──────────────────────────────────────┤ ├─>
N
O
E
D
I
T
S
T
R
I
N
G ───────────────────────────────────────┤ ├─>
N
O
Q
U
E
R
Y
N
A
M
E ────┬──> Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─────────┘ └─>
N
O
D
E
F
A
U
L
T
V
A
L
U
E ─┘ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ Optional formatting clauses allow you to modify data displays or query characteristics for interactive SQL users and DATATRIEVE users. A query header specifies a string that interactive SQL or DATATRIEVE displays in place of the column name when it retrieves values from a column. An edit string specifies a string that controls how interactive SQL or DATATRIEVE formats the display of values in a column. DEFAULT VALUE and QUERY NAME are active only from DATATRIEVE.
ADD_CONSTRAINT
The ADD CONSTRAINT clause adds a CHECK table constraint definition. A CHECK constraint specifies a predicate that column values inserted into the table must satisfy. Predicates in CHECK table constraints can refer to any column in the table. Column select expressions within the predicate can refer to other tables in the schema. The DIAGNOSTIC clause specifies a name for the constraint. The name is used in error messages and ALTER TABLE DROP CONSTRAINT, SHOW TABLE, DECLARE TRANSACTION and SET TRANSACTION statements. The DIAGNOSTIC clause is optional. If you omit the constraint name, SQL creates a name. However, DIGITAL recommends that you always name column and table constraints. The constraint names generated by SQL may be obscure and, in programs, may change between compilation and running.
ALTER_COLUMN
The ALTER COLUMN clause modifies the column specified by the column
name:
alter-col-definition =
──> column-name ─┬────────────────┬┬┬──────────> ─────────────┬┬─>
├─> data-type ───┤│└─> sql-and-dtr-clause ───┘│
└─> domain-name ─┘└────────── <───────────────┘
Additional information available:
More Informationdata typessql and dtr clause
More Information
You can modify some elements of a column definition but not others:
o You cannot change the column name.
o You can change an explicitly specified data type to another, but
use care (see notes in this argument description).
o You can change the domain referred to by a column, provided the
domain exists in the schema
o You can substitute an explicit data type for a column that
previously referred to a domain name
o You cannot change an existing column constraint or add column
constraints to an existing column.
o You can change formatting and DATATRIEVE clauses.
data types
data-type = ──┬─>
C
H
A
R ─┬────────┬───────────────────────────┬──> │ └─> (n) ─┘ │ ├─>
V
A
R
C
H
A
R (n) ───────────────────────────────┤ ├─>
L
O
N
G
V
A
R
C
H
A
R ──────────────────────────────┤ ├─>
S
M
A
L
L
I
N
T ──┬─┬────────┬────────────────────┤ ├─>
I
N
T
E
G
E
R ───┤ └─> (n) ─┘ │ ├─>
Q
U
A
D
W
O
R
D ──┘ │ ├─>
D
E
C
I
M
A
L ─┬─┬─────────────────────────────┬─┤ ├─>
N
U
M
E
R
I
C ─┘ └─> ( ──> n ─┬────────┬─> ) ──┘ │ │ └─> , n ─┘ │ ├─>
F
L
O
A
T ─┬────────┬──────────────────────────┤ │ └─> (n) ─┘ │ ├─>
R
E
A
L ──────────────────────────────────────┤ ├─>
D
O
U
B
L
E
P
R
E
C
I
S
I
O
N ──────────────────────────┤ └─>
D
A
T
E ──────────────────────────────────────┘
sql and dtr clause
sql-and-dtr-clause = ─┬─>
Q
U
E
R
Y
H
E
A
D
E
R typebox (I)typebox (S) ─┬> quoted-string ──┬─────────────────┬─> │ └────── typebox (/) <────────┘ │ ├─>
E
D
I
T
S
T
R
I
N
G typebox (I)typebox (S) quoted-string ─────────────────────────┤ │ │ ├─>
Q
U
E
R
Y
N
A
M
E Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) quoted-string ─┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─>
D
E
F
A
U
L
T
V
A
L
U
E Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─> typebox (I)typebox (S) literal ────┤ │ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ │ ├─>
N
O
Q
U
E
R
Y
H
E
A
D
E
R ──────────────────────────────────────┤ ├─>
N
O
E
D
I
T
S
T
R
I
N
G ───────────────────────────────────────┤ ├─>
N
O
Q
U
E
R
Y
N
A
M
E ────┬──> Ftypebox (O)typebox (R) ─┬─> typebox (D)typebox (T)typebox (R) ────────┬─────────┘ └─>
N
O
D
E
F
A
U
L
T
V
A
L
U
E ─┘ └─> typebox (D)typebox (A)typebox (T)typebox (A)typebox (T)typebox (R)typebox (I)typebox (E)typebox (V)typebox (E) ─┘ Optional formatting clauses allow you to modify data displays or query characteristics for interactive SQL users and DATATRIEVE users. A query header specifies a string that interactive SQL or DATATRIEVE displays in place of the column name when it retrieves values from a column. An edit string specifies a string that controls how interactive SQL or DATATRIEVE formats the display of values in a column. DEFAULT VALUE and QUERY NAME are active only from DATATRIEVE.
DROP_COLUMN
The DROP COLUMN statement deletes the specified column.
DROP_CONSTRAINT
The DROP CONSTRAINT statement deletes the specified column constraint or table constraint from the table definition.