开发者

SqlPlus query issue (Package Spec and Body)

I am trying to get package spec and body from sqlplus by doing so..

select text fro开发者_StackOverflow社区m all_source
where name = 'PACK_JACK'
order by line;

but I am only getting its body not the spec.. what I have to change to get both of them as one file.. Thank you


There is a TYPE column in all_source view. The type can have 2 values - 'PACKAGE' and 'PACKAGE BODY'. So to get the spec,

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

and to get the body

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

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


To get the package body, you run:

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

As opposed to:

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

But chances are you don't have the right to see the package body. So it's hidden from the ALL_SOURCE table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜