Getting Foreign Keys on Oracle
Ozzie
When maintaining a live system, sometimes one must undo a committed transaction on the database. In other words, delete some records and their trails.
A difficulty that sometimes arises on complex relational models, with cascade deletion disabled, is to find out what records on other data tables are pointing to the ones I want to erase.
On Oracle, to find out which tables have a foreign key that points to the primary key of the records we want to delete, one just issue the command:
select * from ALL_CONSTRAINTS where R_CONSTRAINT_NAME = '[Your PK constraint name]'
This statement returns as a result the tables that have a foreign key constraint pointing to the targeted table's primary key.
A difficulty that sometimes arises on complex relational models, with cascade deletion disabled, is to find out what records on other data tables are pointing to the ones I want to erase.
On Oracle, to find out which tables have a foreign key that points to the primary key of the records we want to delete, one just issue the command:
select * from ALL_CONSTRAINTS where R_CONSTRAINT_NAME = '[Your PK constraint name]'
This statement returns as a result the tables that have a foreign key constraint pointing to the targeted table's primary key.
4:27 PM
Programming
Windows System Monitoring
Ozzie
I've started a project on Microsoft's open source initiative CodePlex. It's similar to Source Forge but dedicated to Microsoft .NET framework programming.
I've shared with anyone interested the source code of my effort to build some components for Windows Server monitoring. It won't work with Unix/Linux because it uses WMI (Windows Management Instrumentation).
Anyway, my project's homepage is here and you can feel free to collaborate if you'd like.
I've shared with anyone interested the source code of my effort to build some components for Windows Server monitoring. It won't work with Unix/Linux because it uses WMI (Windows Management Instrumentation).
Anyway, my project's homepage is here and you can feel free to collaborate if you'd like.
6:25 PM
Programming
Subscribe to:
Posts
(
Atom
)