Creating and Managing Data Use Case Domains

Data use case domains are lightweight data type modifiers that encapsulate a set of optional properties and constraints, allowing for the modeling of real-world information such as credit card numbers, email addresses, dates of birth, postal codes, and so on. You can use data use case domains to define how you intend to use the data centrally and share the data with other applications.

See Also: Oracle AI Database Concepts for additional general information about use case domains

Creating Use Case Domains

To create a use case domain, use the DDL statement CREATE DOMAIN.

The following statement creates the email domain.

CREATE DOMAIN email AS VARCHAR2(30)
CONSTRAINT EMAIL_C CHECK (REGEXP_LIKE (email, '^(\S+)\@(\S+)\.(\S+)$'))
DISPLAY '---' || SUBSTR(email, INSTR(email, '@') + 1);

See Also: Oracle AI Database SQL Language Reference for information about the CREATE DOMAIN statement

Dropping Use Case Domains

To drop a use case domain, use the DDL statement DROP DOMAIN.

  1. The following statement drops the email domain.

    DROP DOMAIN email;

    The DROP DOMAIN command does not allow you to drop a domain if that domain is associated with any column on any table.

    You can use the DROP DOMAIN ... FORCE command to disassociate the domain from all columns and drop the domain. Use the FORCE option with caution, because you will lose all domain-specified knowledge on all columns that have been associated with the domain.

  2. The following statement drops the email domain and disassociates the domain from all of its dependent columns.

    DROP DOMAIN email FORCE

See Also: Oracle AI Database SQL Language Reference for information about the DROP DOMAIN statement