How to find the tables and their associated columns referenced in a stored procedure

StackOverflow https://stackoverflow.com/questions/23537166

  •  17-07-2023
  •  | 
  •  

سؤال

I want to list out all the tables and their associated columns which are referenced in a stored procedure.

How can i do it in oracle?

Thanks in advance.

هل كانت مفيدة؟

المحلول 2

You can get tables referenced using this query

SELECT referenced_owner, 
       referenced_name, 
       referenced_type 
FROM   dba_dependencies 
WHERE  name = 'MYPROC' 
       AND owner = 'SCOTT' 
ORDER  BY referenced_owner, 
          referenced_name, 
          referenced_type; 

نصائح أخرى

You can't get all table dependencies in all_dependecies view. If dynamic sql is using in one procedure then the table won't be in dba_dependecies view. So in that case, you could see the table in dba_source (if table name in not a parameter of the function!)

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top