| Author |
how to delete a parent row when a child is deleted?
|
Judy Collins
Greenhorn
Joined: Oct 07, 2004
Posts: 20
|
|
Hi guys This is something similar to cascade deleted that I need. Cascade delete means that when the parent row is deleted, the children rows are deleted. How can I delete a parent row when a child is deleted? triggers? functions? any idea? thanks for your help and have a great weekend
|
 |
Srinivasa Raghavan
Ranch Hand
Joined: Sep 28, 2004
Posts: 1228
|
|
|
Think of a trigger & play with it. But dont know whether its a right approach.
|
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Triggers are meant for this. If you wanna do all in your code then you have to probably go for it by yourself. Although you can do it via code easily, however the opposite case would be complex using code. But in your case one parent -----> many children So, you just need to delete one parent. If multiple hierarchies, you need to delete each parent entry. Then even one trigger wouldn't help you straight. You might have to define more than one trigger. [ March 06, 2005: Message edited by: Adeel Ansari ]
|
 |
 |
|
|
subject: how to delete a parent row when a child is deleted?
|
|
|