• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

deleting rows with referential integrity

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I need to delete specific records from database (e.g. those whose expirydate column has date greater than that of today). At least 10 other tables have reference to this master table and then each of the 10 tables are referenced by other tables. ( i guess you understand what i m trying to say :roll: )

Is there any option available except figuring out all of the tables and then deleting the records?

I am sure there must be some better way.

Any help in this regard is greatly appreciaed
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will recommend to have one additional column as enable/disable flag, and whenever you dont need record simple disable them(Soft delete)

otherwise you can delete them by cascading constraints, I do this in oracle somtimes but NOT recommended.



what about child record ? dont you want to delete them ?
 
Judy Collins
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shailesh Chandra
Thaks for your response. I modified schema and added constraint "on delete cascade" and it appears to be fine. Can you please tell me why don't you recommend cascade?

Thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic