How to determine types of subprograms in Oracle Package

前端 未结 2 1928
一个人的身影
一个人的身影 2021-01-21 15:44

This is best explained with an example. Given the below database objects:

CREATE OR REPLACE PROCEDURE TEST_PROCEDURE IS
BEGIN
  NULL;
END;
/

CREATE OR REPLACE F         


        
2条回答
  •  北海茫月
    2021-01-21 15:59

    You may identify package functions and procedures by using the all_procedures view, examining the data on the method's arguments as it is stored in the data dictionary for a return value:

        SELECT p.object_name
             , p.procedure_name
             , CASE WHEN a.object_id IS NULL THEN 'PROCEDURE' ELSE 'FUNCTION' END ptype
          FROM all_procedures p
     LEFT JOIN all_arguments  a ON (
                                         a.object_id     = p.object_id
                                     AND a.subprogram_id = p.subprogram_id
                                     AND a.data_level    = 0
                                     AND a.argument_name IS NULL
                                   )
         WHERE p.object_name IS NOT NULL
             ;
    

提交回复
热议问题