PL/SQL cursor
CURSOR
1 declare
cursor a(i number) is select * from test where id=i;
b test%rowtype;
begin
open a(i=>1) ;
loop
fetch a into b;
exit when a%notfound;
dbms_output.put_line(b.name);
end loop;
close a;
end;
2 declare
begin
for a in (select * from test) loop
dbms_output.put_line(a.name);
end loop;
end;
3 declare
cursor b(i number) is select * from test where id=i;
begin
for c in b(i=>1) loop
dbms_output.put_line(c.name);
end loop;
end;
4
declare
cursor a is select * from mao where rownum<100;
b mao%rowtype;
begin
for b in a loop
dbms_output.put_line(b.name);
end loop;
end;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9907339/viewspace-1037862/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- PL/SQL 04 遊標 cursorSQL
- shared SQL,parent cursor,child cursorSQL
- oracle procedure儲存過程(pl/sql)_使用declare cursor_begin end巢狀Oracle儲存過程SQL巢狀
- PL/SQLSQL
- SQL 遊標cursorSQL
- SQL&PL/SQL (轉)SQL
- PL/SQL 宣告SQL
- PL/SQL打包SQL
- PL/SQL DEVSQLdev
- oracle pl/sql儲存過程內外層遊標cursor巢狀引數化示例OracleSQL儲存過程巢狀
- 使用PL/Scope分析PL/SQL程式碼SQL
- PLSQL Language Reference-PL/SQL概覽-PL/SQL架構SQL架構
- [PL/SQL]10g PL/SQL學習筆記(一)SQL筆記
- [PL/SQL]10g PL/SQL學習筆記(二)SQL筆記
- [PL/SQL]10g PL/SQL學習筆記(三)SQL筆記
- PL/SQL 迴圈SQL
- PL/SQL 遊標SQL
- PL/SQL 運算子SQL
- PL/SQL 條件SQL
- pl/sql to_dateSQL
- PL/SQL 基礎SQL
- Oracle PL/SQL INDICESOracleSQL
- PL/SQl Developer使用SQLDeveloper
- pl/sql陣列SQL陣列
- pl/sql練習SQL
- oracle PL/SQL示例OracleSQL
- 淺談pl/sqlSQL
- PL/SQL 索引表SQL索引
- pl/sql 練習SQL
- [pl sql] where current ofSQL
- pl/sql功能特性SQL
- PL/SQL Developer 使用SQLDeveloper
- PL/SQL小結SQL
- steven's pl/sqlSQL
- PL/SQL入門SQL
- PL/SQL 設定SQL
- PLSQL Language Reference-PL/SQL概覽-PL/SQL的優點SQL
- Oracle PL/SQL編寫PL/SQL程式碼的注意事項OracleSQL