Oracle:创建存储过程


1.无参存储过程

create or replace procedure test_proc
as
v_total number(10);
begin
  select count(*) into v_total from F_RELATION;
  DBMS_OUTPUT.put_line('总人数:'||v_total);
end;





begin
  test_proc;
end;

 

2.有参存储过程

create or replace procedure test_proc(
v_name in VARCHAR2,
anum in varchar2 ,
cid in integer default 100
)
as
v_total number(10);
begin
  select count(*) into v_total from F_RELATION;
  DBMS_OUTPUT.put_line('总人数:'||v_total||',id='||v_name||',anum='||anum||',cid='||cid);
end;





begin
  test_proc('101','this is anum');
end;



免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM