constraint on type object in oracle - Mailing list pgsql-general

From Florent Garcin
Subject constraint on type object in oracle
Date
Msg-id 43be6384$1@epflnews.epfl.ch
Whole thread Raw
Responses Re: constraint on type object in oracle
List 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

pgsql-general by date:

Previous
From: "Dumortier"
Date:
Subject: Problems reading dump files coming from version 7.1 into version 8.1.
Next
From: Sebastjan Trepca
Date:
Subject: Indexes works only on miss