PL/SQL_2

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章