Solved

How to DESC one procedure from a package

Posted on 2008-06-13
5
1,186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 35

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

696 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