I have two collateral tables, A and B. When I insert data into table A a trigger makes a new record i table B with the identical ID. Afterwards I some times want to delete records in table B - and then I want the related data in A to be deleted as well. Some times I want to delete data in table A and then I want the related data in B as well.
Example:
Table A (ID number, FILE varchar2(20));
data:
1,'file1.txt'
2,'file2.txt'
3,'file3.txt'
Table B (ID number, PATH varchar2(100));
data:
1,'c:\temp\'
2,'d:\data\'
3,'c:\temp\sub\'
If I say: DELETE FROM A WHERE ID=2
I need the record in both tables to be deleted.
If I say DELETE FROM B WHERE ID=2
Should give me the same result (both records deleted)
But I still need to be able to say
INSERT INTO A (4,'newfile.txt')
My trigger will then make the record (4,'') in the table B (and I could update this table afterwards to (4,'c:\newdir\)
If I make the both-way-constraints with cascading deletes - I won't be able to make the insert part.
If you understand my problem, I would be very pleased if you could help me back by showing me an example of how-to-do

)