Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Creating Contraint using sql
On Thu, 18 Sep 1997 20:12:40 -0500, Gary England <gengland_at_hiwaay.net> wrote:
>Cuong Quyen Truong wrote:
>>
>> Does anyone know how to make constraint between relations. For example
>> Relation A has attributes a1(NUMBER) a2(NUMBER) and Relation B has
>> attribures b1(NUMBER) b2(NUMBER) then I would like to make a contraint
>> which say that if a1=b1 then a2 must be > b2.
>
>One way is with a database trigger that is fired on insert/update
>commands to abort the action if the contraint is violated.
or use the following create table:
create table foo
( a1 number, a2 number, b1 number, b2 number,
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD
http://govt.us.oracle.com/ -- downloadable utilities