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: Newbie question on trigger

Re: Newbie question on trigger

From: Andreas Schlegel <schlegelaw_at_epost.de>
Date: Mon, 27 Jan 2003 14:06:36 +0100
Message-ID: <3E352EDC.5070409@epost.de>


Of course, you are right. I should set the foreign key constraints. But in this special case is it very difficult. It is a migration project (Postgresql -> Oracle) and we found a table in the old database that contains a lot of different sections (title, position, function ...). But the application references not on the primary key but on a special key for every section.
To enforce the integrity by foreign constraints I also have to rewrite huge parts of the application. On the long run I do it. But on the short run I need an other solution (I thought about the trigger).

So I hope anybody has an example how to solve it under this special circumstances.

Greetings,
Andreas

Vladimir M. Zakharychev wrote:
> Both tasks are accomplished via declarative integrity constraints
> (FOREIGN KEYs). Oracle automatically enforces them and you
> don't need any triggers for this. With proper foreign key constraints
> in place Oracle won't allow you to delete a row from parent table
> if it has any children (unless your FK is ON DELETE CASCADE or
> ON DELETE SET NULL), and it won't allow you to insert a row into
> child table if there's no corresponding referenced key in parent, as
> well as update it so that it goes out of parent-children relationship
> scope. Consult Oracle Concepts manual and SQL Reference for
> more information on Referential Integrity Constraints (use this
> as search term on http://tahiti.oracle.com if you don't have printed
> manuals or docs CD.)
>
Received on Mon Jan 27 2003 - 07:06:36 CST

Original text of this message

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