• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1190
  • Last Modified:

How to DESC one procedure from a package

We have a situation where we are connecting data silos with common APIs via packages.  In one situation, the packages we want to introduce can be automatically generated based on the footprint of those packages in another silo.  However, that silo includes a lot of cruft in one of the core packages.  Until we can refactor and partition the package, I'd like to create a simple Perl script (or something similar) that takes a list of procedures in the package, does something like a DESC to get the footprint, and generates the package code.  Is there a PL/SQL query using dictionary tables (or something akin) that will allow me to DESC the footprint of a single procedure from within a package?  

Thanks!
0
arktech
Asked:
arktech
1 Solution
 
MikeOM_DBACommented:

Why not just invoke sqlplus and do a DESC?

0
 
arktechAuthor Commented:
Sorry, in re-reading the question as I posed it, I realized I didn't make something clear.  The package that I want to use as the basis for the footprints contains over 200 procedures, of which I only need about 30.  Rather than mirror the entire thing -- we're trying to retire many of those extra footprints -- I would like to selectively mirror the 30 I want.  Ergo, the desire to DESC just an individual procedure from the package.  Yes, I could DESC the entire package, parse it into memory in Perl, and then iterate across the list of methods that I actually want, but I was hoping there was a simpler, more elegant approach.
0
 
Mark GeerlingsDatabase AdministratorCommented:
I'm not aware of a built-in way to do a DESC on an individual procedure or function in a package.  Maybe DBMS_METADATA provides this, but I haven't ever explored that package very much.  Some years ago (probably with Oracle8) I used these two queries as alternatives to DESC.  They still work with Oracle9 and Oracle10. You may be able to use one of these as a starting point for what you need.

SELECT DISTINCT sa.procedure$ "Package objects", d.object_type
FROM sys.argument$ sa, dba_objects d
WHERE sa.obj# = d.object_id
AND d.object_name = upper('pkg_name');

break on package_name;
column ovload noprint
select package_name, object_name, nvl(overload,0) "ovload",
decode(min(position),0,'Function','Procedure') "Type",
count(argument_name) "Parameters"
from all_arguments
where package_name like upper('&pkg_name')
group by package_name, object_name, overload;
0
 
johnsoneSenior Oracle DBACommented:
Unfortunately, Oracle dropped the functionality to be able to describe a procedure in a package.

You can try looking at the ALL_ARGUMENTS view, it should give you the information.  NOTE:  There is no DBA_ counterpart to this view, it is only ALL_ and USER_
0
 
arktechAuthor Commented:
Bingo!  That was the nudge I needed!  The following gives me exactly what I was looking for:

select argument_name, in_out, data_type
from all_arguments
where package_name = UPPER('mypackage')
and object_name = UPPER('sproc_name')
order by position;

Thank you very much!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now