tags:

views:

41

answers:

4

Hi,

I have newbie question, what is best way to show function FUNCTION1 from package PACK ?

DESC PACK.FUNCTION1 does not work :(

Thanks

A: 

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        
Michael Pakhantsov
That hasn't always been possible. Older versions of SQL Plus only allow you to describe an entire package.
Tony Andrews
Instant Client 11.2 (and 11.1) only allow a describe on an entire package (at least on an 10gR2 database)
Gary
On Oracle 7 you could only describe a specific procedure, not the whole package. Now they've gone the other way. Doing both would have been good!
JulesLt
+3  A: 

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'.

be here now
A: 

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.

JulesLt
A: 

Thanks.

It is really unpleasant to manage ORACLE server (7v worst).

Finally, I established SSH tunnel to this server and used ORACLE DBA software.

Michal Drozd