ORACLE 存儲過程的基本語法以下:spa
create or replace procedure 存儲過程名(參數) is或ascode
聲明參數blog
beginit
代碼class
end 存儲過程名。select
其中or replace表明若是沒有此存儲過程則建立,若是有的話則更新存儲過程。語法
下面是一個存儲過程的簡單例子:存儲過程
create or replace procedure Vid_UnRegStateNoCharging ( pTelno in varchar2, pClass in number, pVid in out varchar2, pAgent in varchar2, pRole in varchar2, pRe out number, pDesc out varchar2 ) is tTmpNum number:=0; tVidOnUnRegReNotes number:=0; begin select count(*) into tTmpNum from t_online where TELNO = pTelno; if(tTmpNum < 1) then select count(*) into tVidOnUnRegReNotes from T_UNREG_LOG where TELNO = pTelno ; if(tVidOnUnRegReNotes>1) then pRe :=10; pDesc:='用戶已註銷,沒法計費.'; return; end if; end if; commit; pRe :=0; pDesc :='正常'; return; end Vid_UnRegStateNoCharging;
存儲過程裏能夠有一些邏輯判斷,也能夠存儲過程調用存儲過程,上面的In 表明輸入參數,out表明輸出參數。di