Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    14

    Red face Unanswered: how to create domain?

    Does anyone know how to convert the following SQL CREATE DOMAIN statements to equivalent Oracle10g sql:

    SQL> create domain GenderDomain char(2) constraint GD check ( value in('f','m'));

    great thanks!

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    You'll have to create a table:
    Code:
    CREATE TABLE gender_domain
    (gender VARCHAR2(1) PRIMARY KEY,
                        CONSTRAINT ch_gen CHECK (gender IN ('M', 'F')));
    Now, use this table in your application and reference gender from other tables (this is why 'gender_domain' has a primary key constraint - without it, you wouldn't be able to create a referential integrity constraint).

  3. #3
    Join Date
    Mar 2004
    Posts
    14
    so in oracle, we can not create a domanin. isn't right?

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    As far as I can tell, yes: there's no DOMAIN as such in Oracle. However, Designer *knows* domains (but that's a different story).

  5. #5
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    That's right. CREATE DOMAIN is (I believe) part of ANSI standard SQL, but it os not supported by Oracle.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •