SQL$HELP_OLD72.HLB  —  User Supplied Names, Domain Names
    A domain is the set of values that a table column can have.

    A domain definition restricts the set of values that a table
    column can have by associating a data type with a domain name,
    and allows optional formatting and collating clauses. The CREATE
    and ALTER TABLE statements refer to domain names in column
    definitions. The domain name must be unique among domain names
    in the schema.

    You can use a domain when defining columns in multiple tables.
    Once you have defined a domain, use the CREATE or ALTER TABLE
    statement to define a column based on the domain definition.

    You can qualify the domain name with the schema name (when the
    domain belongs to a multischema database) or with the alias.

    In general, you should use domains when you create tables. Using
    domains:

    o  Ensures that similar columns in multiple tables comply to one
       standard. For example, if you define the columns using the
       domain ID_DOM, the data type for all these columns is CHAR(5).

    o  Allows you to change the data type for all columns defined
       using a domain by changing the domain itself. For example,
       if you want to change the data type for POSTAL_CODE_DOM from
       CHAR(5) to CHAR(10), you only need to alter the data type for
       POSTAL_CODE_DOM. You do not have to alter the data type for
       the column POSTAL_CODE in the tables COLLEGES and EMPLOYEES.

    You might not want to use domains when you create tables if:

    o  You are creating intermediate result tables. It takes time to
       plan what the domains are in the database and to define them.
       Intermediate result tables might not warrant this effort.

                                   NOTE

       In syntax diagrams, the domain-name syntax element refers to
       either the qualified or unqualified form of the name given
       to the domain in the CREATE DOMAIN statement.

  domain-name =

  -+---------------------------+-> <name-of-domain> --->
   +-+-> <schema-name> -+-> . -+
     +-> <alias> -------+
Close Help