Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: conditional foreign key constraint
Note in-line
-- Regards Jonathan Lewis http://www.jlcomp.demon.co.uk The educated person is not the person who can answer the questions, but the person who can question the answers -- T. Schick Jr Next public appearance2: March 2004 Hotsos Symposium - Keynote March 2004 Charlotte NC - OUG Tutorial April 2004 Iceland One-day tutorials: http://www.jlcomp.demon.co.uk/tutorial.html Three-day seminar: see http://www.jlcomp.demon.co.uk/seminar.html ____UK___February The Co-operative Oracle Users' FAQ http://www.jlcomp.demon.co.uk/faq/ind_faq.html "Daniel Morgan" <damorgan_at_x.washington.edu> wrote in message news:1074097744.811435_at_yasure...Received on Thu Jan 15 2004 - 07:12:18 CST
> Cookie Monster wrote:
>
> > Hi,
> >
> > I want to create a foreign key constraint which is only checked when a
> > certain value in one of the field is set. such that I have a field
called
> > STATUS and when the value equals 1 then my foreign key is active on that
> > row. I guess this is not really possible without a trigger but a
trigger
> > would take forever as I have thousands of rows. has anyone had
something
> > similar and has an idea of how I could perhaps do this.
> >
> > Thanks in advance
> > cookie.
>
> What you have hear screams in pain that you have a design issue. There
> is no possible relational design I can imagine, and I have a reasonably
> fertile imagination, that requires such a conditional constraint.
>
Case*Method : Entity Relationship Modelling Richard Barker 1989. p. 4 - 3 - Exclusion Arcs: Each account must be against one and only one individual or against one and only one company. The OPs question sounds like one possible strategy for a physical implemention of a fairly common design requirement.
> Why don't you tell us the business problem you are trying to solve and
> let us suggest the solution rather than telling us "your" solution and
> asking us to figure out how to do it.
>
My example above does not, of course, invalidate your follow-up comment.
![]() |
![]() |