Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to delete a parent row when a child is deleted?

 
Judy Collins
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1228
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think of a trigger & play with it. But dont know whether its a right approach.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic