How to show function code from a package in ORACLE?

What is the best way to show the FUNCTION1 function from the PACK package?

DESC PACK.FUNCTION1 does not work

+3
source share
3 answers

What do you mean by the word "show"? You can see the implementation of the package body this way:

select text 
  from all_source a 
 where a.type = 'PACKAGE BODY' 
   and a.name = 'YOUR_PACKAGE' 
 order by line asc

although you cannot extract only a specific function from a package in this way. You can do the same with stand-alone functions by installing a.type = 'FUNCTION'.

+13
source

Well, the best thing is probably to use something like SQLDeveloper (or TOAD), which has a schema browser, syntax highlighting, etc. OR extracting a source from text files that you can paste into your favorite editor.

USER_SOURCE, .

Oracle DESC PACK.FUNCTION1, Oracle 7, DESC PACK.

+1

Maybe the function FUNCTION1 exists in the PACK package ?? Because it works.

  SQL> desc dbms_output.put_line
   Parameter Type     Mode Default? 
   --------- -------- ---- -------- 
   A         VARCHAR2 IN            

SQL> desc dbms_random;

  Element    Type      
  ---------- --------- 
  SEED       PROCEDURE 
  VALUE      FUNCTION  
  NORMAL     FUNCTION  
  STRING     FUNCTION  
  INITIALIZE PROCEDURE 
  RANDOM     FUNCTION  
  TERMINATE  PROCEDURE 
  NUM_ARRAY  TYPE      

SQL> desc dbms_random.value

  Parameter Type   Mode Default? 
  --------- ------ ---- -------- 
  (RESULT)  NUMBER               
  (RESULT)  NUMBER               
  LOW       NUMBER IN            
  HIGH      NUMBER IN        
0
source

Source: https://habr.com/ru/post/1763481/


All Articles