oracle获取某个包依赖的所有对象包括其子对象
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了oracle获取某个包依赖的所有对象包括其子对象,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2787字,纯文字阅读大概需要4分钟。
内容图文
![oracle获取某个包依赖的所有对象包括其子对象](/upload/InfoBanner/zyjiaocheng/567/e81e557efc4a45bfadb8b494fce79e14.jpg)
使用了一个一个临时表 记录了已经遍历的 节点 同时 使用了层数来记录已经遍历的 包 PL/SQL dba_dependencies Oracle declare -- 获取相应的 某个程序包 所需要应用的包 cursor p_cur(p_name varchar2) is select dd.name, dd.type, dd.referenced_name, dd.re
使用了一个一个临时表 记录了已经遍历的 节点同时 使用了层数来记录已经遍历的 包 PL/SQL dba_dependencies 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;
内容总结
以上是互联网集市为您收集整理的oracle获取某个包依赖的所有对象包括其子对象全部内容,希望文章能够帮你解决oracle获取某个包依赖的所有对象包括其子对象所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。