如何在oracle中列出特定存储过程中使用的所有表

时间:2014-01-20 14:24:18

标签: oracle plsql

我需要获取oracle中特定存储过程中使用的所有表的列表。如何使用查询获取该列表?

2 个答案:

答案 0 :(得分:3)

Dynamic SQL被跳过,因为它们在编译期间未在SEMANTIC项检查中得到验证

select 
   proc_syn.referenced_owner, 
   proc_syn.referenced_name, 
   proc_syn.referenced_type,
   syn_tab.table_name
from 
   dba_dependencies proc_syn, dba_synonyms syn_tab, dba_tables tables
where 
     proc_syn.name= 'YOUR_PROC' 
  AND REFERENCED_TYPE in ( 'SYNONYM','TABLE')
  AND proc_syn.referenced_name = syn_tab.synonym_name
  AND syn_tab.synonym_name = tables.table_name
  AND syn_tab.owner = 'PUBLIC'
order by 
  proc_syn.referenced_owner, syn_tab.table_name;

答案 1 :(得分:0)

select 
   referenced_owner, 
   referenced_name, 
   referenced_type
from 
   dba_dependencies
where 
   name= 'PROC_NAME' AND REFERENCED_TYPE = 'TABLE'
order by 
   referenced_owner, referenced_name, referenced_type;