Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Newbie question on trigger
Hmm... Can you be a bit more specific on this matter? What's the
table layout, what are these 'sections' and how are they referenced
in the application? Why do you think that you will have to rewrite
the application to be able to use built-in referential integrity controls?
Maybe you can try to build an E/R model over the existing database
and then engineer it a bit to add needed constraints (sometimes
seeing the whole picture graphically simplifies things significantly.)
-- Vladimir Zakharychev (bob@dpsp-yes.com) http://www.dpsp-yes.com Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications. All opinions are mine and do not necessarily go in line with those of my employer. "Andreas Schlegel" <schlegelaw_at_epost.de> wrote in message news:3E352EDC.5070409_at_epost.de...Received on Tue Jan 28 2003 - 01:14:59 CST
> 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.)
> >
>