1.一個簡單的存儲過程
create or replace procedure pro_sample(
i_number1 in number default 0,
i_number2 in number default 0,
o_result out varchar2)
is
i_result number;
begin
i_result := i_number1 / i_number2;
o_result := i_number1||'/'||i_number2||'='||i_result;
exception
when others then
o_result:='除數不能為0';
end pro_sample;

2.調試
如果plsql develope 工具調試存儲時 始終是灰色,請考慮,本用戶是否有調試存儲的權限.
如果沒有權限請執行以下sql語句
GRANT debug any procedure, debug connect session TO test;
3.plssql的一些總結
1).流程控制1
if 條件 then
執行語句
else if 條件 then
執行語句
else if 條件 then
執行語句
else
執行語句
end if;
2).流程控制2
1.case 檢測
case 檢測表達式
when value1 then
執行語句
when value2 then
執行語句
else
執行語句
end case;
2.case 搜索式
case
when 條件1 then
執行語句
when 條件2 then
執行語句
when 條件2 then
執行語句
else
執行語句
end case
3).循環
1. 簡單循環
loop
執行語句
exite when 條件
end loop;
2.while 循環
while 條件 loop
執行語句
end loop;
3.for in循環
for 變量 in 下限..上限 loop
執行語句
end loop;