从数据字典中查找包全局变量 [英] Find package global variables from data dictionary
本文介绍了从数据字典中查找包全局变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包:
CREATE PACKAGE my_pkg
IS
g_var NUMBER;
END;
/
有没有什么办法可以查询SYS视图,发现这个包有这个全局变量?我对显式变量名称和数据类型感兴趣。
解析user_source不计数。
编辑:我想这样做,而不会引入getter / setter函数。
select name as variable_name,object_name as package_name,object_type $ b $ from dba_identifiers a
where usage_context_id = 1
and usage ='DECLARATION'
and type ='VARIABLE '
在('PACKAGE','PACKAGE BODY')中以object_type开始
通过之前的usage_id = usage_context_id
和object_name = prior object_name
和object_type = prior object_type
I have a package:
CREATE PACKAGE my_pkg
IS
g_var NUMBER;
END;
/
Is there any way I can query SYS views, to find that this package has this global variable? I'm interested in explicit variable name and data type.
P.S. Parsing user_source does not count.
Edit: I would like to do that without introducing getter/setter functions.
解决方案
For my own reference, here is a query that gets that information from data dictionary -
select name as variable_name, object_name as package_name, object_type
from dba_identifiers a
where usage_context_id = 1
and usage = 'DECLARATION'
and type = 'VARIABLE'
start with object_type in ('PACKAGE', 'PACKAGE BODY')
connect by prior usage_id = usage_context_id
and object_name = prior object_name
and object_type = prior object_type
这篇关于从数据字典中查找包全局变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文