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