oracle学习--循环语句
2010-07-05 09:48
141 查看
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;
相关文章推荐
- oracle学习--循环语句
- oracle学习--循环语句
- Oracle 条件语句和循环语句的学习(1)
- oracle学习--循环语句
- oracle学习--循环语句
- oracle控制语句学习四——while循环控制语句、for循环控制语句 递增 递减、嵌套循环和标号
- Oracle学习——循环与控制语句
- oracle学习--循环语句
- oracle 学习之:for循环中包涵select语句
- oracle控制语句学习三——loop 循环控制语句
- [Oracle]匿名循环过程语句实验[转]
- python基础教程_学习笔记7:条件、循环、其它语句
- MySQL与Oracle 差异比较之四条件循环语句
- 条件、循环和其他语句——Python学习系列之三
- 我的Java学习笔记1——java执行Oracle的sql语句时报错ORA-00911无效字符错误
- Oracle 游标 隐式游标,显示游标,游标循环,动态SELECT语句和动态游标,异常处理,自定义异常
- Oracle-merge语句学习
- Oracle [PL/SQL]中的循环语句
- Oracle 条件语句/循环语句
- 8.从零开始学习C语言--while循环语句