The following table describes how using the SQL ALTER TABLE statement impacts the CA Datacom Datadictionary definition.
ALTER TABLE table-name
Updates the definition of the specified table.
column-name
Defines a column (FIELD entity-occurrence) in the table. The following are the significant FIELD entity-occurrence attributes defined:
Additional attributes are defined based on the column definition syntax.
The column must be added to the end of the table.
datatype
Defines the column's data type through the following FIELD entity-occurrence attributes:
DEFAULT literal
For the FIELD entity-occurrence, defines a literal value in the VALUE attribute and sets the DEFAULT-INSERT attribute to O.
DEFAULT USER
For the FIELD entity-occurrence, sets the DEFAULT-INSERT attribute to U.
DEFAULT SYSTEM USER
For the FIELD entity-occurrence, sets the DEFAULT-INSERT attribute to S.
DEFAULT NULL
For the FIELD entity-occurrence, leaves the NULL-INDICATOR attribute unchanged. Removes a previously specified numeric or literal default value, but does not alter the nullability (NULL-INDICATOR attribute) of a column.
NOT NULL
For the FIELD entity-occurrence, sets the NULL-INDICATOR attribute to N. NOT NULL can be used when adding a column, but not when modifying a column.
PRIMARY KEY
Creates a key consisting of this column or columns and a constraint. The following are the significant KEY entity-occurrence attributes defined:
The following are the significant CONSTRAINT entity-occurrence attributes defined:
The TABLE entity-occurrence has the following attributes that pertain to constraints:
You cannot copy over or delete a table or any part of a table while it has a constraint.
UNIQUE
Defines a key consisting of the identified column or columns and a constraint. The following are the significant KEY entity-occurrence attributes defined:
The following are the significant CONSTRAINT entity-occurrence attributes defined:
The TABLE entity-occurrence has the following attributes that pertain to constraints:
WITH DEFAULT
For the FIELD entity-occurrence, sets the DEFAULT-INSERT attribute to D.
REFERENCES table-name
Sets the TABLE entity-occurrence CNS-REFERS= and CONSTRAINT= attributes to Y for this table.
Sets the referenced TABLE entity-occurrence CNS-REFERENCED= and CONSTRAINT= attributes to Y.
CHECK (search condition)
Creates a constraint. The following are the significant CONSTRAINT entity-occurrence attributes defined:
The TABLE entity-occurrence has the following attributes that pertain to constraints:
CONSTRAINT constraint-name
Sets the CONSTRAINT entity-occurrence SQLNAME attribute to the name supplied in this parameter.
ADD table constraint
Modifies the table to add one of the constraints that follows to the table.
FOREIGN KEY (column-list)
Defines a key consisting of this column or columns and a constraint. The KEY entity-occurrence has the following attributes:
The following are the significant CONSTRAINT entity-occurrence attributes defined:
The TABLE entity-occurrence has the following attributes:
Sets the referenced TABLE entity-occurrence CNS-REFERENCED= and CONSTRAINT= attributes to Y.
REFERENCES table-name (column-list)
Sets the TABLE entity-occurrence CNS-REFERS= and CONSTRAINT= attributes to Y for this table.
Sets the referenced TABLE entity-occurrence CNS-REFERENCED= and CONSTRAINT= attributes to Y.
CHECK (search condition)
Creates a constraint. The following are the significant CONSTRAINT entity-occurrence attributes defined:
CONSTRAINT constraint-name
Sets the CONSTRAINT entity-occurrence SQLNAME attribute to the name supplied in the statement.
DROP CONSTRAINT constraint-name
Obsoletes the CONSTRAINT entity-occurrence specified. The KEY entity-occurrence remains. Views that reference the constraint's table are marked invalid.
You can drop the foreign key only if there are no primary keys that reference it. Views based on this table are marked invalid.
DROP column-name
Obsoletes the column. All plans, views, and synonyms that reference the column are marked invalid.
DROP PRIMARY KEY
Obsoletes the CONSTRAINT entity-occurrence. The KEY entity-occurrence remains. The DROP PRIMARY KEY statement is successful only if there are no foreign keys that reference this primary key. Views based on the table associated with the constraint are marked as invalid.
DROP FOREIGN KEY identifier
Obsoletes the KEY entity-occurrence created as the foreign key and the CONSTRAINT entity-occurrence.
Views based on the table associated with the obsoleted key are marked as invalid.
MODIFY column-name DEFAULT literal
For the FIELD entity-occurrence, defines a literal value in the VALUE attribute and sets the DEFAULT-INSERT attribute to O.
MODIFY column-name DEFAULT USER
For the FIELD entity-occurrence, sets the DEFAULT-INSERT attribute to U.
MODIFY column-name DEFAULT SYSTEM USER
For the FIELD entity-occurrence, sets the DEFAULT-INSERT attribute to S.
MODIFY column-name DEFAULT NULL
For the FIELD entity-occurrence, sets the DEFAULT-INSERT attribute to N.
MODIFY column-name data type
Modifies the column's data type changing the following FIELD entity-occurrence attributes:
All plans and views that reference the column are marked invalid.
RENAME column-name TO column-name
For the FIELD entity-occurrence, changes the SQLNAME to the name specified in the RENAME statement. All plans, views, and synonyms that reference the column are marked invalid. The ENTITY-NAME attribute is not changed from its current value in CA Datacom Datadictionary.
|
Copyright © 2014 CA.
All rights reserved.
|
|