Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to implement DOMAINs?

Re: How to implement DOMAINs?

From: Johann Sander <jsander_at_puc-online.de>
Date: 7 Apr 2003 07:54:18 -0700
Message-ID: <ff2b8f88.0304070654.664405e0@posting.google.com>


Hello Andrew,

> ...
> Unfortunately, Oracle doesn't support the DOMAIN syntax. It does have
> user-defined TYPEs, but these don't address the issue of specifying
> constraints on the data values: you can only create constraints on
> columns, not on TYPEs.

That is pretty much frustrating. Is there no demand for something like this? I mean, it would help with data integrity issues, wouldn't it?

> ...
> BTW, your check constraint would not work as intended, since CHAR values
> are always automatically blank-padded to their full length anyway:
>
> SQL> create table t ( code char(5) check (length(code) = 5));
>
> Table created.
>
> SQL> insert into t values ('x');
>
> 1 row created.

Good point, my mistake, make this read:

CREATE DOMAIN AREACODE INTEGER CONSTRAINT VALIDCODE CHECK ( VALUE BETWEEN 10000 AND 99999 ); Johann Received on Mon Apr 07 2003 - 09:54:18 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US