存储过程和函数:& 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; |