Solved

How to DESC one procedure from a package

Posted on 2008-06-13
5
1,184 Views
Last Modified: 2013-12-19
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
Comment
Question by:arktech
5 Comments
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 21778816

Why not just invoke sqlplus and do a DESC?

0
 

Author Comment

by:arktech
ID: 21778867
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
 
LVL 35

Accepted Solution

by:
Mark Geerlings earned 250 total points
ID: 21779179
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
 
LVL 34

Expert Comment

by:johnsone
ID: 21779605
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
 

Author Comment

by:arktech
ID: 21779624
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question