1.遊標類型
--定義一個遊標類型
declare
type emp_cursor is ref cursor;
--定義一個遊標變量
test_cursor emp_cursor;
v_ename xxx.xxx%type;
v_esal xxx.xxx%type;
begin
--執行
--把test_cursor和一個select結合
open test_cursor for select xxx,xxx from xxx where xxx;
--循環取出
loop
fetch test_cursor into v_ename,v_esal;
exit when test_cursor%notfound
end loop;
end;
2.注意plsql的寫法 elsif 不是elseif. 少一個e
3.幾種循環
1)loop.......end loop
2) while ......loop ..... end loop;
3) for i in reverse 1..10 loop ......... end loop