Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Imposing Functional Dependencies

Re: Imposing Functional Dependencies

From: Andreas <andreas.prusch_at_oracle.com>
Date: 6 Feb 2002 23:10:18 -0800
Message-ID: <1121163a.0202062310.2ba635f4@posting.google.com>


"Yash" <yash_ganthe_at_hotmail.com> wrote in message news:<a3sth0$noe$1_at_news.vsnl.net.in>...
> Hi,
> I have a table myTable(A,B,C,D). I know that for a given C value, the
> value of D is fixed. Thus C functionally determines D. I don't want to
> normalise the table. I only want to enforce this constraint so that nobody
> inserts rows that have different values for the same value of C. How do I
> set the constarint? I am looking for the Oracle DDL statement in particular.
>
> Thanks.

Hi Yash,

i think, there's no way to define such a constraint declarative with ddl. You should use trigger instead, which automatically fill the d value.

create or replace trigger <name>
before insert or update on <table>
for each row
begin
  select <column wich determines d) into :new.d from <where ever> where <one row condition>;
end;

Best regards,
Andreas Received on Thu Feb 07 2002 - 01:10:18 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US