How to see PL/SQL Stored Function body in Oracle

前端 未结 3 1045
北海茫月
北海茫月 2021-01-01 11:02

I have a stored function in Oracle database pAdCampaign.fGetAlgoGroupKey. How to see the code of this function.?

相关标签:
3条回答
  • 2021-01-01 11:21

    If is a package then you can get the source for that with:

        select text from all_source where name = 'PADCAMPAIGN' 
        and type = 'PACKAGE BODY'
        order by line;
    

    Oracle doesn't store the source for a sub-program separately, so you need to look through the package source for it.

    Note: I've assumed you didn't use double-quotes when creating that package, but if you did , then use

        select text from all_source where name = 'pAdCampaign' 
        and type = 'PACKAGE BODY'
        order by line;
    
    0 讨论(0)
  • 2021-01-01 11:27
    SELECT text 
    FROM all_source
    where name = 'FGETALGOGROUPKEY'
    order by line
    

    alternatively:

    select dbms_metadata.get_ddl('FUNCTION', 'FGETALGOGROUPKEY')
    from dual;
    
    0 讨论(0)
  • 2021-01-01 11:33

    You can also use DBMS_METADATA:

    select dbms_metadata.get_ddl('FUNCTION', 'FGETALGOGROUPKEY', 'PADCAMPAIGN') 
    from dual
    
    0 讨论(0)
提交回复
热议问题