Thread: constraint on type object in oracle

constraint on type object in oracle

From
Florent Garcin
Date:
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

Re: constraint on type object in oracle

From
John Meyer
Date:
Florent Garcin wrote:
> Hello!
>
> I've a project to implement in oracle using odmg and I'm stuck...
>
Hi, I'm kind of new here, but shouldn't you be asking Oracle questions
in oracle mailing lists?