Hallo:
I'm trying to list all packages, functions and procedures of a schema.
This list has to include:
- package name (global variables and types, functions and procedures)
- functions
- procedures
Functions and procedures with name, parameters, type of parameters, in/out of parameters and return type (for functions).
Example:
pkg1.variable1 pls_integer;
pkg1.variable2 varchar2(1000);
pkg1.funcion1(p1 in varchar2, p2 in varchar2, p3 in pls_integer) return varchar2;
...
pkg2.procedure1(p1 in varchar2, p2 in varchar2, p3 in pls_integer);
I've tried using the view "all_arguments" for packages, procedures and functions but is a bit complicated to use and doesn't have global variables.
Is there any easy way to get the list?
If the only way is to use the view "all_arguments", is there a way to get the global variables?
Thanks
ALL_ARGUMENTS is only a fraction of the picture, because lots of procedures will take NO arguments, and hence not appear in there at all.
Here's something to get you started
select
p.owner,
p.object_name,
p.procedure_name,
p.subprogram_id,
listagg(argument_name,',') within group ( order by position, sequence ) as parms
from dba_procedures p,
dba_arguments a
where p.owner = ...
and p.owner = a.owner(+)
and p.object_name = a.package_name(+)
and p.subprogram_id = a.subprogram_id(+)
group by p.owner,
p.object_name,
p.procedure_name,
p.subprogram_id
order by 1,2,4;
but in terms of global variables, the only way I know to do that would be to parse the source (from DBA_SOURCE). Because I can put a global variable pretty much *anywhere* in the source, eg
SQL> create or replace
2 package pkg is
3 x int;
4
5 procedure y;
6
7 z int;
8
9 procedure w;
10 end;
11 /
Package created.
So unless you have some conventions/standards in your organisation (globals at the top etc), they could be anywhere
Hope this helps