【问题标题】:SqlPlus query issue (Package Spec and Body)SqlPlus 查询问题(包规范和正文)
【发布时间】:2011-10-22 15:03:02
【问题描述】:

我正在尝试通过这样做从 sqlplus 获取包规范和正文..

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

但我只得到它的主体而不是规范..我必须改变什么才能将它们都作为一个文件..谢谢

【问题讨论】:

    标签: oracle package sqlplus


    【解决方案1】:

    all_source 视图中有一个 TYPE 列。该类型可以有 2 个值 - 'PACKAGE' 和 'PACKAGE BODY'。所以要获得规范,

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

    得到身体

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

    此外,您可以使用 user_source,而不是使用 all_source。 all_source 包括包括系统包在内的所有内容。 USER_SOURCE 只有用户定义的包。

    【讨论】:

      【解决方案2】:

      要获取包体,请运行:

      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 表中是隐藏的。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-07-28
        • 1970-01-01
        • 2013-08-09
        • 1970-01-01
        • 2010-12-28
        • 2022-11-04
        • 1970-01-01
        相关资源
        最近更新 更多