1 – char-data-types
A valid SQL character data type. For more information on
character data types, see the Data_Types HELP topic.
2 – character-set-name
A valid character set name. For a list of allowable character set
names, see the Supported_Character_Sets HELP topic.
3 – COLLATING_SEQUENCE
Specifies a new collating sequence for the named domain.
The OpenVMS National Character Set (NCS) utility provides a
set of predefined collating sequences and also lets you define
collating sequences of your own. The COLLATING SEQUENCE clause
accepts both predefined and user-defined NCS collating sequences.
Before you use the COLLATING SEQUENCE clause in an ALTER DOMAIN
statement, you must first specify the NCS collating sequence for
SQL using the CREATE COLLATING SEQUENCE statement. The sequence
name argument in the COLLATING SEQUENCE clause must be the same
as the sequence name in the CREATE COLLATING SEQUENCE statement.
4 – COMMENT_IS
Adds a comment about the domain. SQL displays the text of the
comment when it executes a SHOW DOMAIN statement. Enclose the
comment in single quotation marks ( ') and separate multiple
lines in a comment with a slash mark (/).
5 – date-time-data-types
A data type that specifies a date, time, or interval. For more
information on date-time data types, see the Data_Types HELP
topic.
6 – DEFAULT value-expr
Provides a default value for a domain.
You can use any value expression including subqueries,
conditional, character, date/time, and numeric expressions as
default values. See Value Expressions for more information about
value expressions.
For more information about NULL, see the NULL_Keyword HELP topic.
The value expressions described in Value Expressions include
DBKEY and aggregate functions. However, the DEFAULT clause is
not a valid location for referencing a DBKEY or an aggregate
function. If you attempt to reference either, you receive a
compile-time error.
If you do not specify a DEFAULT for a column, it inherits the
DEFAULT from the domain. If you do not specify a default for
either the column or domain, SQL assigns NULL as the default
value.
7 – domain-constraint
Adds or modifies a constraint for the existing named domain.
Domain constraints specify that columns based on the domain
contain only certain data values or that data values can or
cannot be null.
Use the CHECK clause to specify that a value must be within a
specified range or that it matches a list of values. When you
specify a CHECK clause for a domain constraint, you ensure that
all values stored in columns based on the domain are checked
consistently.
To refer to the values of all columns of a domain constraint, use
the VALUE keyword. For example:
SQL> CREATE DOMAIN dom1 CHAR(1)
cont> CHECK (VALUE IN ('F','M'))
cont> NOT DEFERRABLE;
For any dialect other than SQL99, SQL92, ORACLE LEVEL 1 or
ORACLE LEVEL 2, you must specify that domain constraints are
NOT DEFERRABLE.
When you add (or modify) a domain constraint, SQL propagates
the new constraint definition to all the columns that are based
on the domain. If columns that are based on the domain contain
data that does not conform to the constraint, SQL returns the
following error:
%RDB-E-NOT_VALID, validation on field DATE_COL caused operation to fail
8 – domain-name
The name of a domain you want to alter. The domain name must be
unique among domain names in the database.
9 – DROP_DEFAULT
Deletes (drops) the default value of a domain.
10 – IS datatype
A valid SQL data type. For more information on data types, see
the Data_Types HELP topic.
11 – NO_COLLATING_SEQUENCE
Specifies that the named domain uses the standard default
collating sequence, that is, ASCII. Use the NO COLLATING SEQUENCE
clause to override the collating sequence defined for the schema
in the CREATE SCHEMA or ALTER SCHEMA statement, or the domain in
the CREATE DOMAIN statement.
12 – RENAME_TO
Changes the name of the domain being altered. See the RENAME for
further discussion. If the new name is the name of a synonym then
an error will be raised.
The RENAME TO clause requires synonyms be enabled for this
database. Refer to the ALTER DATABASE statement SYNONYMS ARE
ENABLED clause. Note that these synonyms may be deleted if they
are no longer used by database definitions or applications.
13 – SET_DEFAULT
Provides a default value for a column if the row that is inserted
does not include a value for that column. A column default
value overrides a domain default value. If you do not specify
a default value, SQL assigns NULL as the default value. For more
information about NULL, see the NULL_Keyword HELP topic.
14 – sql-and-dtr-clause
Optional SQL and DATATRIEVE formatting clause. For more
information on the formatting clauses, see the DATATRIEVE HELP
topic.
15 – value-expr
Specifies the default value of a domain.