Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Whare are the differences between DEFINITION and DECLARATION in plscope?

ronald_2017Jun 21 2022

Hello All,

What are the differences between DEFINITION and DECLARATION in plscope?

In order to get all package body procedures and functions excluding sub procedures and functions, wil the following query works?

SELECT * FROM (
    SELECT NAME, TYPE, LINE START_LINE, LEAD(LINE) OVER(ORDER BY LINE)-1 END_LINE 
    FROM (
        SELECT a.*, level lv, lpad(' ', 4 * level)||NAME FROM ( 
            SELECT *
            FROM ALL_IDENTIFIERS
            WHERE OBJECT_TYPE = 'PACKAGE BODY'
            AND OBJECT_NAME = 'PACKAGE_NAME'
            AND OWNER = USER
            AND (TYPE IN ('FUNCTION', 'PROCEDURE') OR USAGE_ID = 1)
            AND USAGE IN ('DEFINITION', 'DECLARATION')
        ) a
        START WITH USAGE_ID = 1
        CONNECT BY 
        PRIOR USAGE_ID = USAGE_CONTEXT_ID
        ORDER BY USAGE_ID
    )
    WHERE LV = 2
)

Thanks

This post has been answered by user9540031 on Jun 26 2022
Jump to Answer
Comments
Post Details
Added on Jun 21 2022
10 comments
304 views