Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Seeking Equivalent of InterBase Domain
MRCarver wrote:
> Mark D Powell wrote:
>> MRCarver wrote: >>>> Well, first off .. InterBase <> Oracle. Don't try to reverse engineer >>>> to work like something else. >>> Not trying to reverse engineer, but simply trying to grasp Oracle's >>> equivalent to Interbase's "DOMAIN". A "DOMAIN", such as in Interbase or >>> in CASE tools like Embarcedero's ERStudio, describe commonly used data >>> types with certain constraints. This way you define the constraint >>> once, then simply bind it to a given field. >>>> Second, maybe I'm missing something, but it looks like you are wanting >>>> a boolean data type for a primary key column???? That would mean you >>>> could only ever have two rows in the table. I must be missing >>>> something. >>>> >>> Not primary key, just a field having boolean choices. Other examples of >>> likely domains are >>> "POSTAL_CODE_DOMAIN" >>> "GENDER_DOMAIN" >>> "ADDRESS_DOMAIN" >> >> >> I haven't seen the term domain used to describe the range of values an >> attribute can hold in a long time. I can see some advantages in such a >> feature. However, Oracle really does not offer a direct equilivent >> nor do I think you want to use user types in your tables to provide >> this functionality. >> >> I am of the opinion that objects, like java, belongs in the middle
Once again Oracle has this capability and has had it since at least version 8.0.6.
Very simply:
SQL> CREATE OR REPLACE TYPE first_name AS OBJECT (
2 first_name VARCHAR2(25));
3 /
Type created.
SQL> CREATE OR REPLACE TYPE last_name AS OBJECT (
2 last_name VARCHAR2(35));
3 /
Type created.
SQL> CREATE TABLE person (
2 fname first_name,
3 lname last_name,
4 dob DATE);
Table created.
SQL> desc person
Name Null? Type ----------------------------------------- -------- ---------- FNAME FIRST_NAME LNAME LAST_NAME DOB DATE
SQL> I'd be highly inclined not to do it for many reasons but the capability is most certainly in Oracle.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Fri Jan 19 2007 - 21:42:54 CST
![]() |
![]() |