ALTER DOMAIN Examples
-
Changing the data type to
INTEGERand setting or changing the default value to 2,000:ALTER DOMAIN CUSTNO TYPE INTEGER SET DEFAULT 2000; -
Renaming a domain.
ALTER DOMAIN D_BOOLEAN TO D_BOOL; -
Deleting the default value and adding a constraint for the domain:
ALTER DOMAIN D_DATE DROP DEFAULT ADD CONSTRAINT CHECK (VALUE >= date '01.01.2000'); -
Changing the
CHECKconstraint:ALTER DOMAIN D_DATE DROP CONSTRAINT; ALTER DOMAIN D_DATE ADD CONSTRAINT CHECK (VALUE BETWEEN date '01.01.1900' AND date '31.12.2100'); -
Changing the data type to increase the permitted number of characters:
ALTER DOMAIN FIRSTNAME TYPE VARCHAR(50) CHARACTER SET UTF8; -
Adding a
NOT NULLconstraint:ALTER DOMAIN FIRSTNAME SET NOT NULL; -
Removing a
NOT NULLconstraint:ALTER DOMAIN FIRSTNAME DROP NOT NULL;