Home » SQL & PL/SQL » SQL & PL/SQL » SQL Rational Links Between Tables
SQL Rational Links Between Tables [message #40150] Wed, 11 September 2002 10:43 Go to next message
Don Wray
Messages: 2
Registered: September 2002
Junior Member
I'm trying to take 3 tables in a database and make a rational link between them that will explain to each that if a record is deleted in 1 then it should be deleted in the other 2 as well... this is for a card access and biometric system and i'm just lost on how to do this integration... plz help...

Signed,
LAMER
Re: SQL Rational Links Between Tables [message #40151 is a reply to message #40150] Wed, 11 September 2002 10:51 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Since the delete can go "any way", not just from parent to child, you won't be able to use declarative referential integrity to handle the delete - instead, you can use a trigger on each table. Here is what the trigger on table a (of a, b, c) would look like:

create or replace trigger a_trg
after delete on a
for each row
begin
  delete
    from b
   where id = :old.id;
 
  delete
    from c
   where id = :old.id;
end;


09-11-01
Re: SQL Rational Links Between Tables [message #40174 is a reply to message #40151] Fri, 13 September 2002 07:06 Go to previous message
Don Wray
Messages: 2
Registered: September 2002
Junior Member
oops no i didn't, i'm sorry
Previous Topic: Number Field
Next Topic: I've a ORA-04091 Mutating table on my db... but its works on another bd!
Goto Forum:
  


Current Time: Sat May 04 08:19:10 CDT 2024