SqlPlus query problem (package specification and body)

I am trying to get the package specification and body from sqlplus by doing this.

select text from all_source
where name = 'PACK_JACK'
order by line;

but I only get his body, not the specification. What do I need to change to get both of them as a single file. Thank.

+5
source share
2 answers

The all_source view has a TYPE column. A type can have 2 values ​​- "PACK" and "PACK BODY". So, to get the specification,

select text from all_source
where name = 'PACK_JACK'
and type = 'PACKAGE'
order by line;

and get the body

select text from all_source
where name = 'PACK_JACK'
and type = 'PACKAGE BODY'
order by line;

Alternatively, instead of using all_source, you can use user_source. all_source includes everything, including system packages. USER_SOURCE has only user-defined packages.

+6
source

, :

select text from all_source
where name = 'PACK_JACK'
  and type = 'PACKAGE BODY'
order by line;

:

select text from all_source
where name = 'PACK_JACK'
  and type = 'PACKAGE'
order by line;

, , . ALL_SOURCE.

+2

All Articles