I have a parent table and want to delete a row but it has 'child' tables with foreign keys pointing to the primary key in the parent table.
We support four DBMS (Oracle, MySQL, PostgreSQL, SQL Server) and are adding more.
The table structure is such that the child tables have child tables and so on, probably if you follow it, 15 tables in all need a row deleted to just delete a row in a parent table.
I need a database agnostic way to 'delete cascade' a row, even if the table was not created with this option. In other words the framework would recursively find the leaf rows, delete those first and then work it's way up to the parent table and report any problems or throw an exception if this were the case.
I am looking for any/all solutions from anyone who has actually done this and was able to get it to work on multiple databases or any of the databases listed above.
thanks
J.V.
|