constraint on type object in oracle

From: Florent Garcin <florent(dot)garcin(at)epfl(dot)ch>
To: pgsql-general(at)postgresql(dot)org
Subject: constraint on type object in oracle
Date: 2006-01-06 11:33:08
Message-ID: 43be6384$1@epflnews.epfl.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello!

I've a project to implement in oracle using odmg and I'm stuck...

Assume that we have the following script:

create or replace type Tmyenum is object (
myenum varchar2(10)
);

create or replace type a is object (
...
);

create or replace type b under a (
bla Tmyenum,
...
);

create or replace type c under a (
...
);

create table bigA of a;

So, we can see that a is like a superclass of b and c.

Now, I would like to set a constraint on Tmyenum which check if the
inserted value is in a given set. Something like constraint check_myenum
check (myenum in ('blue', 'red', ...)).

I don't know if it's possible to add a constraint directly on the type
definition. If it's not, I though to put it on the table bigA with a
trigger or something. In that case, how do you check if the inserted row
is from type b or c in the trigger?

Thank you in advance!

Florent

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bricklen Anderson 2006-01-06 15:05:50 Re: Data loading from a flat file...
Previous Message Sebastjan Trepca 2006-01-06 11:14:03 "Could not open relation with OID x" while deleting a row