(Oracle)如何获取程序列表,函数包?

时间:2015-08-19 07:18:56

标签: sql oracle function stored-procedures package

RHEL5上的Oracle 11gR2

如何在程序包中获取程序,功能列表?

示例,有两个包。

PACKAGE pkg1  
  PROCEDURE pkg1_pro1 ~~
  PROCEDURE pkg1_pro2 ~~
  FUNCTION pkg1_func1 ~~

PACKAGE pkg2
  PROCEDURE pkg2_pro1 ~~
  FUNCTION pkg2_func1 ~~
  FUNCTION pkg2_func2 ~~

然后,有结果。

SELECT blah, blah
FROM blah
WHERE package_name = 'PKG1'


Package_name    Type        Name
PKG1            PROCEDURE   pkg1_pro1
PKG1            PROCEDURE   pkg1_pro2
PKG1            FUNCTION    pkg1_func1

怎么做?

2 个答案:

答案 0 :(得分:1)

SELECT OBJECT_NAME AS "Package_name",OBJECT_TYPE AS "TYPE",PROCEDURE_NAME as "Name"
FROM ALL_PROCEDURES
WHERE owner     = 'Your Owner'
AND object_name = 'YOUR_PACKAGE';

修改:

 SELECT A.OBJECT_NAME AS "Package_name",
  A.PROCEDURE_NAME AS "TYPE",
  B.OBJECT_TYPE as "Name"
FROM ALL_PROCEDURES A,
  ALL_OBJECTS B
WHERE A.OWNER='YOUR OWNER'
and A.OBJECT_NAME ='YOUR PACKAGE'
AND a.procedure_name=b.object_name;

答案 1 :(得分:0)

以下查询将提供包装中存在的所有物品

 SELECT  D.PACKAGE_NAME,D.OBJECT_NAME,A.OBJECT_TYPE
    FROM dba_arguments D
    INNER JOIN
    ALL_OBJECTS A
    ON
    A.OBJECT_NAME=D.OBJECT_NAME
    AND A.owner=D.OWNER
      WHERE
      D.OWNER='OWNER_NAME' AND
      D.PACKAGE_NAME='PACKAGE_NAME'

确保owner_name和package_name是大写字母。