Oracle 包的学习

来源:互联网 发布:软件开发程序文件 编辑:程序博客网 时间:2024/05/21 16:22

包是为了将功能相近的函数或存储过程组织在一起,便于管理。

包内的函数可以重名,提高程序的通用性,减少对象的名称占用问题。
一个包内函数使用,整个包都调入内存。
包内一个程序失效,整个包重新编译。
由包头和包体组成。


包头
不能加密。
描述了包内的函数,存储过程的参数。
可以独立存在。


包体
可以加密。
函数的实现
不能独立存在

包定义的语法如下:

CREATE [OR REPLACE] PACKAGE package_name
[AUTHID {CURRENT_USER | DEFINER}]
{IS | AS}
[PRAGMA SERIALLY_REUSABLE;]
[collection_type_definition ...]
[record_type_definition ...]
[subtype_definition ...]
[collection_declaration ...]
[constant_declaration ...]
[exception_declaration ...]
[object_declaration ...]
[record_declaration ...]
[variable_declaration ...]
[cursor_spec ...]
[function_spec ...]
[procedure_spec ...]
[call_spec ...]
[PRAGMA RESTRICT_REFERENCES(assertions) ...]
END [package_name];
[CREATE [OR REPLACE] PACKAGE BODY package_name {IS | AS}
[PRAGMA SERIALLY_REUSABLE;]
[collection_type_definition ...]
[record_type_definition ...]
[subtype_definition ...]
[collection_declaration ...]
[constant_declaration ...]
[exception_declaration ...]
[object_declaration ...]
[record_declaration ...]
[variable_declaration ...]
[cursor_body ...]
[function_spec ...]
[procedure_spec ...]
[call_spec ...]
[BEGIN
sequence_of_statements]

END [package_name];]



原创粉丝点击