I want to delete all the rows from a table in the Oracle DB ieTable Name:Address.
The table is used as the foreign key in other tables for example in Customers.
what i want is , When i delete all the rows of the table Address, All rows of other tables which are referencing these records should also be deleted.
NOTE I have not provided "on delete cascade" at the time of creating table.
Any help is appreciated.
That really depends on what you mean.
By your description you probably mean a cascading delete.
But that makes no sense, since your table is a foriegn key, so every "customer" would have an AddressID (int) column, and probably a NOT NULL column as well. so deleting all addresses would be ... deleting the entire customer table? or maybe DELETE FROM customer WHERE AddressID IS NOT NULL ? either way, that does not make sense.
Oh, I get it now. you are testing the boundaries of your ability. That actually makes sense in DEV environment. But make sure you don't do stuff like that in production. A couple of principles which I have found very good practice -
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.