Skip to Main Content
  • Questions
  • Can you find where a specific column from a specific table is used in Oracle?

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Richard.

Asked: October 29, 2024 - 3:20 pm UTC

Last updated: November 01, 2024 - 5:45 am UTC

Version: 19c

Viewed 100+ times

You Asked

As a database developer, I try to ensure column names in tables are not named something like "TYPE", or "OWNER", or "PRIMARY". It seems redundant to a Java developer to add a column to a table that indicates the OWNER of a PRODUCT to a column named PRODUCT_OWNER... after all, in the Java Entity, the property is "owner", and it's obviously the Product Owner.

The problem comes in when the business wants to have multiple Owners, so we have to go find out all the code that references OWNER, but just for this table, and we have multiple tables with OWNER columns.

Or the column is something like TYPE, and the word TYPE is all over the database objects.

Or we want to drop the column, and want to see where it's used (this one is easier, drop the column in a test database, and see what breaks.)

There are 100 different cases where, as a database developer, I need to know where a column is used. I know there are ways you can find certain things, like in SYS.ALL_DEPENDENCIES, or searching other tables where COLUMN_NAME = 'OWNER', or looking in USER_SOURCE, etc. Some are helpful, others just return a lot of noise.

Obviously, the Oracle compiler knows which columns are used where, otherwise, the syntactic compile wouldn't work. Is it possible to find this information via a data dictionary view?

and Connor said...