Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to: Trigger on table A that reference to B Delete from table B

732185Nov 4 2009 — edited Nov 6 2009
Hi, i write this first post because i have a strange situation that i never see during my other "work" using oracle xe 10g:

I have a table A with a column "Invention" that reference to a column "Invention1" in another table B. On the reference on table A i have on delete cascade enabled:
CREATE TABLE  "A" 
   (	"SomeOther" NUMBER NOT NULL ENABLE, 
         "Invention" NUMBER NOT NULL ENABLE, 
	 CONSTRAINT "A_FK" FOREIGN KEY ("Invention")
	  REFERENCES  "B" ("Invention1") ON DELETE CASCADE ENABLE, 
   )
On this table i have a before delete trigger that check if there is only one record about "Invention" i want to delete, only in this case i have to delete the "invention1" also from B table. I seach on google and read more and more document but i can not find a valid solution, can anyone help me?

Thanks, and sorry for "eventually" bad english.

Edited by: user12169154 on 4-nov-2009 22.04
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 4 2009
Added on Nov 4 2009
18 comments
2,136 views