Search Postgresql Archives

constraint on type object in oracle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux