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

Home -> Community -> Usenet -> c.d.o.server -> Re: Seeking Equivalent of InterBase Domain

Re: Seeking Equivalent of InterBase Domain

From: William Robertson <williamr2019_at_googlemail.com>
Date: 20 Jan 2007 07:21:56 -0800
Message-ID: <1169306515.972556.51460@38g2000cwa.googlegroups.com>


MRCarver wrote:
> Daniel,
>
> Thanks again for the attention !
>
> Can one further define the TYPE with a constraint? Something like:
>
> CREATE OR REPLACE TYPE Bool_DOM OBJECT (
> Bool_DOM VARCHAR2(1) with CONSTRAINT BoolChk ((Bool_DOM IN('Y', 'N"))
> );

I hadn't come across Interbase or its Domain feature before but it sounds like quite a nice idea. Oracle doesn't have anything like this. I don't think object types are close, as they are not scalar and can't include constraints. If you used the above BOOL_DOM object type for a table column you would have to repeat the attribute name (in your example, 'bool_dom') everywhere using dot notation:

SELECT e.empno, e.ename, e.is_director.bool_dom FROM employees;

and use constructor syntax to set its value:

INSERT INTO employees (is_director) VALUES (BOOL_DOM('Y'));

Also queries would return the complex object rather than a scalar.

This would not give you any of the benefits you are after.

btw CHAR sucks, and I would personally avoid it even for fixed-length columns such as mandatory indicators. Received on Sat Jan 20 2007 - 09:21:56 CST

Original text of this message

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