PLS-2--25Using Parameters in PL/SQL Procedure

PLS-21:PL/SQL Stored Procedure(PLS-21)

     Stored program includes procedure, function and package
  have a name;can take and return parameters;can be stored in database; all users can call.
  Advantages are easy maintenance, security and performance(no parse, no network latency and integrity)
     
  How to develop the SP:
  write->load the code with sqlplus or other tools->source code->compile->parsed code->{exec SP} on sqlplus
     or {begin helloworld;end;}->drop SP
  create or replace procedure SPname as
 

 
PLS-22: Using Parameters in PL/SQL Procedure
 create or replace procedure hello(p_name IN VARCHAR2, p_age OUT NUMBER)//formal parameters
  hello('hello', age) or hello(p_age=>7,p_name=>'infor')//actual parameters
 create or replace procedure hello(p_name IN OUT NUMBER)
  x:=15;
  hello(x);
  
PLS-23: PL/SQL Stored Functions
  The number of predifined functions by oracle is 200+;
  it must return a value;
  it is not allowed to commit or rollback or updatein the function body for select query;
  it is not allowed to select in the function body for update query;
  create or replace function hello(p_name IN varchar2) return varchar2 as
  v_result varchar2(100);
  drop function hello;
  you can check the body by accessing to the <user_source> table;
  

  
PLS-24: PL/SQL Package Introduction

    How to implement it:
  create or replace package xyz as
   function F1(p1 number) retrun number;
   procedure p1(p2 number);
  end xyz

  create or replace package body xyz as
  end xyz
 
 How to call it:
  xyz.insert_number(444)
  xyz.isEven(89;)
  
 What's the advantage
  modulize
  easy maintenance and readibility
  code hiding (private function and API)
  overloading
  performance
  
  
  
PLS-25: Visibility Rules in PL/SQL Packages
 Package without body is ok
 there are global fields and private fields
 


 
  

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值