How do you programatically identify a stored procedure's dependencies?

前端 未结 4 512
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-19 21:59

Is it possible to write a PL/SQL query to identify a complete list of a stored procedures dependencies? I\'m only interested in identifying other stored procedures and I\'d

4条回答
  •  爱一瞬间的悲伤
    2021-01-19 22:30

    On this page, you will find the following query which uses the PUBLIC_DEPENDENCY dictionary table:

     SELECT lvl
         , u.object_id
         , u.object_type
         , LPAD (' ', lvl) || object_name obj
       FROM ( SELECT LEVEL lvl, object_id
                FROM SYS.public_dependency s
             START WITH s.object_id =
                          ( SELECT object_id
                              FROM user_objects
                             WHERE object_name = UPPER ('&OBJECT_NAME')
                               AND object_type = UPPER ('&OBJECT_TYPE'))
             CONNECT BY s.object_id = PRIOR referenced_object_id
             GROUP BY LEVEL, object_id) tree
          , user_objects u
      WHERE tree.object_id = u.object_id
    ORDER BY lvl
    /
    

提交回复
热议问题