Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

deleting rows with referential integrity  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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: 1085
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!