Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Compare rows in diffrent table
vikram_morey_at_rediffmail.com (vikram morey) wrote in message news:<1df1ef17.0206110045.58672433_at_posting.google.com>...
> Dear All
>
> I have a problem.
>
> I want to compare rows in the tables in my schema. If any two rows are
> identical by any combination in any given table, it should not allow
> me to delete the same.
>
> Can someone help me out, by giving a solurtion for that. I am thinking
> of writing a procedure using minus and union all, or writing a before
> delete trigger.
>
> Which will be better and how to do it.
>
> Thanks,
>
> Vikram
Sounds like you really want a primary Key to foreign key relation. That would prevent deleting the record from the "parent" table (the one with the primary key) because there are records in the "child" table that use those values. Advantage to this is there is no code that you must maintain )other than defining the keys), ORACLE does it for you.
You now know a little terminology. I suggest you use it to go learn more about relational database design in general and ORACLE features in particular.
A little learning is a dangerous thing;
drink deep, or taste not the Pierian spring:
there shallow draughts intoxicate the brain,
and drinking largely sobers us again.
Alexander Pope (1688-1744) - An Essay on Criticism.
-- Edward J. Prochak --- Magic Interface, Ltd. Ofc: 440-498-3700 on the web at --- http://www.magicinterface.com email: ed.prochak_at_magicinterface.comReceived on Tue Jun 11 2002 - 12:43:12 CDT