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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Foreign Key constraints

Re: Foreign Key constraints

From: Andreas Mentzfeld <amentzfeld_at_debitel.net>
Date: Mon, 22 Nov 1999 21:16:15 +0100
Message-ID: <3839A48F.F811FDB@debitel.net>


It's a fact, that you can use constraints to fulfill referential integity of your db.
But this is not the only way. You can also use triggers (that means PL/SQL) and stored procedures to fulfill (e. g. pre-inserting trigger) and to check the referential integrity.
In case of replicated data, the only way to fulfill integrity is to use PL/SQL. In your case, you have to program the constraints in PL/SQL by yourself. That means, check the tables wether there is a child without a parent. If there is, you can decide what to do.
If you want to avoid a child without a parent, use a pre-inserting trigger that perhaps gives a warning back. (That's exactly what a 'real' constraint would do)

Andreas

jdefreitas_at_my-deja.com wrote:

> Hi all.
>
> My project leader has decided to disable the foreign key constraing
> property in our Oracle 8.0.5 DB. This means that the value of a primary
> key in the parent table can now be different from the foreign key value
> in the child table. Needless to say, this isn't a Good Thing.
>
> He's asked me to write a script that will basically scan the tables,
> and check referential integrity. I'm a little stumped by this request -
> does anyone have an idea of how this could be done using PL/SQL? Thanks.
>
> John G. de Freitas
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Mon Nov 22 1999 - 14:16:15 CST

Original text of this message

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