loop循环的几种用法
2010-05-17 22:03
232 查看
loop循环:
create or replace procedure pro_test_loop is
i number;
begin
i:=0;
loop
i:=i+1;
dbms_output.put_line(i);
if i>5 then
exit;
end if;
end loop;
end pro_test_loop;
while循环:
create or replace procedure pro_test_while is
i number;
begin
i:=0;
while i<5 loop
i:=i+1;
dbms_output.put_line(i);
end loop;
end pro_test_while;
for循环1:
create or replace procedure pro_test_for is
i number;
begin
i:=0;
for i in 1..5 loop
dbms_output.put_line(i);
end loop;
end pro_test_for;
for循环2:
create or replace procedure pro_test_cursor is
userRow t_user%rowtype;
cursor userRows is
select * from t_user;
begin
for userRow in userRows loop
dbms_output.put_line(userRow.Id||','||userRow.Name||','||userRows%rowcount);
end loop;
end pro_test_cursor;
create or replace procedure pro_test_loop is
i number;
begin
i:=0;
loop
i:=i+1;
dbms_output.put_line(i);
if i>5 then
exit;
end if;
end loop;
end pro_test_loop;
while循环:
create or replace procedure pro_test_while is
i number;
begin
i:=0;
while i<5 loop
i:=i+1;
dbms_output.put_line(i);
end loop;
end pro_test_while;
for循环1:
create or replace procedure pro_test_for is
i number;
begin
i:=0;
for i in 1..5 loop
dbms_output.put_line(i);
end loop;
end pro_test_for;
for循环2:
create or replace procedure pro_test_cursor is
userRow t_user%rowtype;
cursor userRows is
select * from t_user;
begin
for userRow in userRows loop
dbms_output.put_line(userRow.Id||','||userRow.Name||','||userRows%rowcount);
end loop;
end pro_test_cursor;
相关文章推荐
- loop循环的几种用法
- Java for循环的几种用法
- Java for循环的几种用法分析
- PHP中for循环语句的几种“变态”用法
- java中的for 循环的几种用法解析
- Sum under at end of in loop(循环中sum的用法实例)
- losetup命令_Linux losetup 命令用法详解:设定与控制循环(loop)设备
- MySQL 中的三中循环 while loop repeat 的基本用法
- oracle的loop等循环语句的几个用法小例子[转]
- PHP中for循环语句的几种“变态”用法
- list 循环几种用法
- PHP中for循环语句的几种“变态”用法
- Java for循环的几种用法分析
- Java for循环的几种用法分析
- PHP中for循环语句的几种“变态”用法
- 几种有用的变型 PHP中循环语句的用法介绍
- C语言输入函数作为循环条件的几种用法
- php for循环语句的几种用法分析
- Java里面for循环的几种用法
- Java for循环的几种用法