SqlPlus query issue (Package Spec and Body)

 ̄綄美尐妖づ 提交于 2019-12-04 09:24:54

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!