1.包中定义的存储过程,必须在包体中实现;但包体中实现的存储过程在包中可以不定义;
2.存储过程实现中,一旦有BEGIN...END pro_name;在BEGIN与END之间必须有代码块。
3.存储过程实现中,如果过程没有入参与出参列表,则直接写过程名,没有"()"
4.在包头与包体中声明中包括以下几种定义:
包头:
create or replace package test is
-- Author : ADMINISTRATOR
-- Created : 2012-5-22 15:02:04
-- Purpose :
-- Public type declarations
type <TypeName> is <Datatype>;
-- Public constant declarations
<ConstantName> constant <Datatype> := <Value>;
-- Public variable declarations
<VariableName> <Datatype>;
-- Public function and procedure declarations
function <FunctionName>(<Parameter> <Datatype>) return <Datatype>;
end test;
包体:
create or replace package body test is
-- Private type declarations
type <TypeName> is <Datatype>;
-- Private constant declarations
<ConstantName> constant <Datatype> := <Value>;
-- Private variable declarations
<VariableName> <Datatype>;
-- Function and procedure implementations
function <FunctionName>(<Parameter> <Datatype>) return <Datatype> is
<LocalVariable> <Datatype>;
begin
<Statement>;
return(<Result>);
end;
begin
-- Initialization
<Statement>;
end test;
以上语句是通过PL/SQL中图形化界面创建包时,自动生成的,如果想对包定义有一个宏观概念,参照以上代码块,实际上在以后编程中,都应该参照以上代码块编写程序。