Skip to Main Content
  • Questions
  • how to find dependencies between columns in oracle

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, prashant.

Asked: March 10, 2011 - 1:21 pm UTC

Last updated: March 10, 2011 - 1:25 pm UTC

Version: 11.1.2

Viewed 1000+ times

You Asked

Hi,

I have a table that has dependencies between the columns via a fomulae.

Table name TEST:

columns ->
--------------------------------------------------------------------------
| C1 C2 C3 C4 C5 Forumla
R | R1.1 R1.2 R1.3 R1.4 R1.5 R1.5=[C1,R1.1]+[C4,R4.2]-[C3,R3.5]
O | R2.1 R2.2 R2.3 R2.4 R2.5 R2.3=[C2,R2.4]*[C4,R4.1]
W | R3.1 R3.2 R3.3 R3.4 R3.5
S | R4.1 R4.2 R4.3 R4.4 R4.5 R4.3=[C3,R2.3]/[C3,R5.3]
| R5.1 R5.2 R5.3 R5.4 R5.5
---------------------------------------------------------------------------

Based on the presence of the formula, I want to build a dependecy graph and store the same in a new db table. It must also list me the level of dependency by a number. Is this possible in Oracle? I am running on Oracle 11g.

Will dba_dependencies view or dbms_utility.get_dependencies pkg be of any help to me? Any pointers on how to solve this problem?

Thanks in advance,
Prashant.

and Tom said...

You have data
this data needs processing

DBA_DEPENDENCIES - in fact anything about dependencies you see anywhere in our documentation - is about dependencies between schema objects such as tables, views, plsql, etc.

We know nothing about your data and how to process it and what your concept of a dependency is.

In fact, in looking at your example, I myself don't really know what output you would be expecting. I have no idea what this formula of yours means.


But - you do, you know how to parse it. I would suggest parsing it and storing it in a structured format (you know, rows and columns) that permits you to query it much like I can query DBA_DEPENDENCIES right now to figure out what objects depend on my table (for example)




Is this answer out of date? If it is, please let us know via a Comment

More to Explore

DBMS_UTILITY

More on PL/SQL routine DBMS_UTILITY here