足球游戏_中国足彩网¥体育资讯$

Oracle如何获取指定包
来源:易贤网 阅读:805 次 日期:2014-10-17 09:34:15
温馨提示:易贤网小编为您整理了“Oracle如何获取指定包”,方便广大网友查阅!

oracle 获取某个包 依赖的所有对象包括其子对象

使用了一个一个临时表 记录了已经遍历的 节点

同时 使用了层数来记录已经遍历的 包

效率一般,可以改动性大

declare

-- 获取相应的 某个程序包 所需要应用的包

cursor p_cur(p_name varchar2) is

select dd.name, dd.type, dd.referenced_name, dd.referenced_type

from dba_dependencies dd

where 1 = 1

and dd.referenced_type in

('PACKAGE', 'SYNONYM', 'TABLE', 'SEQUENCE')

and dd.type in ('PACKAGE', 'PACKAGE BODY')

AND dd.name = p_name;

cursor p_temp(l_level number) is

select attribute1, attribute2

from cux_common_imports_temp

where attribute2 = l_level;

p_root_name varchar2(30);

p_level number := 0;

p_count number := 0;

begin

--将根节点 放入到表中

p_root_name := 'CUX_SBU_COMMON';

insert into cux_common_imports_temp

(attribute1, attribute2)

values

(p_root_name, p_level);

p_count := 1;

--循环这一层的 节点 并获得其子节点

while p_count != 0 loop

for p_loop in p_temp(p_level) loop

--下一层

p_level := p_level + 1;

p_root_name := p_loop.attribute1;

for p_rec in p_cur(p_root_name) loop

if p_rec.referenced_type = 'PACKAGE' then

--如果表内 没有这个程序就 加入到 临时表中

select count(*)

into p_count

from cux_common_imports_temp

where attribute1 = p_rec.referenced_name;

if p_count = 0 then

insert into cux_common_imports_temp

(attribute1, attribute2)

values

(p_rec.referenced_name, p_level);

end if;

--输出相应的 子节点信息

dbms_output.put_line(p_level || '-Name:' ||

p_rec.referenced_name || '-Type:' ||

p_rec.referenced_type);

end if;

end loop;

end loop;

--获取 该层是否为空

select count(*)

into p_count

from cux_common_imports_temp

where attribute2 = p_level;

end loop;

end;

中国足彩网信息请查看IT技术专栏

中国足彩网信息请查看数据库
易贤网手机网站地址:Oracle如何获取指定包
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标