Oracle存储过程入门

    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中图形化界面创建包时,自动生成的,如果想对包定义有一个宏观概念,参照以上代码块,实际上在以后编程中,都应该参照以上代码块编写程序。




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值