a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 54|回复: 0

[其他] Oracle认证:存储过程和函数的区别

[复制链接]
发表于 2012-8-4 13:41:06 | 显示全部楼层 |阅读模式
存储过程和函数:& p( Y+ q' q, s9 t' w* b* X! q
  例子:
/ x2 p1 ?3 |2 r( C- H7 ^0 a  //创建过程
9 R- H$ |: ~0 Y, F) d( G. P" I  create or replace procedure add_emailinfo(namee email_info.fullname%type ,address email_info.email_address%type )8 T- k" I5 b1 F+ r; N$ ~
  is+ K  j1 I8 v3 a& J- h# }  H
  begin9 p9 q6 ~1 H: r) ?8 H* M7 X
  insert into email_info(fullname,email_address) values (namee,address);% }# B3 J' f# _0 i4 D
  end;
" }% w& y6 I* q$ l  //调用过程
& C2 ]* k5 D9 s5 X! f4 J  call add_emailinfo('cherry','asdfsdf');  [8 O* M; w  l0 @
  /////////////////////////////////////////////////////////////////////////////////////5 p. n: [, W+ L1 J: @. Q- x
  //创建函数9 ?: m$ n, A. V; l+ j& q3 t; i3 j/ K
  create or replace function sel_emailinfo(namee email_info.fullname%type )
- u$ e0 @; L" h) E# Q  return varchar2 is/ h- }8 \, u7 O' u3 a- @
  address varchar2(30);
% [5 h/ g+ t$ A: G: f- w4 q  begin
4 j6 W1 U$ q# }  select email_address into address from email_info0 @6 i4 h  O0 C6 X' C3 X7 {% l, e# d
  where trim(fullname)=trim(namee);: B! n6 u7 C7 ^: W
  return address;6 e" d- N% ?1 }8 ~
  end ;- G* q5 F8 q8 }& k/ |5 {# X* _
  //调用函数0 o6 w$ q6 v9 ?3 P5 Z1 w1 @! B
  select sel_emailinfo('bbb') from dual;
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-5-22 17:54 , Processed in 0.414242 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表