开发者

How show function code from package in ORACLE?

开发者 https://www.devze.com 2023-01-14 20:17 出处:网络
What is best way to show function FUNCTION1 from package PACK ? DESC PACK.FUNCTION1 does not 开发者_JS百科workWhat do you mean by saying \"to show\"?

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

DESC PACK.FUNCTION1 does not 开发者_JS百科work


What do you mean by saying "to show"? You can see a package body implementation this way:

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

though you can't extract only a certain function from a package this way. You can do the same with standalone functions by setting a.type = 'FUNCTION'.


Well, the best way is probably using something like SQLDeveloper (or TOAD) that has a schema browser, syntax highlighting, etc OR extracting the source out into text files that you can throw into your favourite editor.

Both options beat querying and reformatting the source in USER_SOURCE just to find a function spec.

Pretty poor going on Oracle's part as DESC PACK.FUNCTION1 used to work on Oracle 7, but they switched it over to DESC PACK only.


May be function FUNCTION1 does exists in package PACK?? 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        


If you happen to be connected via intelliJ's or Pycharm's database tool, the easiest way is via the UI.

First double-click on the package in the database tool:

How show function code from package in ORACLE?

On the tab that opened, choose to introspect the package:

How show function code from package in ORACLE?

Wait for the introspection to finish. Either you directly see the code or you need to go to the definition/package body:

How show function code from package in ORACLE?

0

精彩评论

暂无评论...
验证码 换一张
取 消