国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 數(shù)據(jù)庫(kù) > Oracle > 正文

Oracle如何獲取指!定包

2019-11-02 14:25:50
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

   oracle 獲取某個(gè)包 依賴的所有對(duì)象包括其子對(duì)象

  使用了一個(gè)一個(gè)臨時(shí)表 記錄了已經(jīng)遍歷的 節(jié)點(diǎn)

  同時(shí) 使用了層數(shù)來(lái)記錄已經(jīng)遍歷的 包

  效率一般,可以改動(dòng)性大

  declare

  -- 獲取相應(yīng)的 某個(gè)程序包 所需要應(yīng)用的包

  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

 

藍(lán)光電影[www.aikan.tv/special/languangdianying/]
 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

  --將根節(jié)點(diǎn) 放入到表中

  p_root_name := 'CUX_SBU_COMMON';

  insert into cux_common_imports_temp

  (attribute1, attribute2)

  values

  (p_root_name, p_level);

  p_count := 1;

  --循環(huán)這一層的 節(jié)點(diǎn) 并獲得其子節(jié)點(diǎn)

  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

  --如果表內(nèi) 沒有這個(gè)程序就 加入到 臨時(shí)表中

  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;

  --輸出相應(yīng)的 子節(jié)點(diǎn)信息

  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;

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 曲靖市| 同江市| 云梦县| 门头沟区| 江北区| 东乡县| 平塘县| 凤阳县| 三都| 建瓯市| 尼玛县| 迁西县| 五河县| 忻城县| 靖边县| 淳化县| 小金县| 桂东县| 孝义市| 元阳县| 信阳市| 友谊县| 海淀区| 湛江市| 沧源| 贵港市| 神木县| 涞源县| 巴南区| 施秉县| 巴彦淖尔市| 曲麻莱县| 萨迦县| 沙湾县| 伊宁县| 墨竹工卡县| 安福县| 温宿县| 翁牛特旗| 凤凰县| 台东市|