Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to implement DOMAINs?
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