Solved

How to DESC one procedure from a package

Posted on 2008-06-13
5
1,182 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
Comment Utility

Why not just invoke sqlplus and do a DESC?

0
 

Author Comment

by:arktech
Comment Utility
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 34

Accepted Solution

by:
Mark Geerlings earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Salary Amount Format 13 56
one-way data "masking" MD5 sql 26 95
Oracle Syntax 8 38
sql query 5 51
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now