不一样的坚强

  博客园 :: 首页 :: 联系 ::  :: 管理
  247 Posts :: 1 Stories :: 194 Comments :: 4 Trackbacks

公告

昵称:快乐就好
园龄:4年8个月
粉丝:8
关注:1

搜索

 

常用链接

最新随笔

积分与排名

  • 积分 - 203647
  • 排名 - 415

最新评论

阅读排行榜

评论排行榜

推荐排行榜

oracle学习--循环语句


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;
posted on 2007-06-22 14:10 快乐就好 阅读(20460) 评论(1) 编辑 收藏

Feedback

Exit When 也很方便:


Declare
p_SN int := 1;
Begin
Loop
Exit When (p_SN > 15);
DBMS_OUTPUT.PUT_LINE(p_SN);
p_SN := p_SN + 1;
End Loop;
End;
 回复 引用   
发表评论

昵称: [登录] [注册]

主页:

邮箱:(仅博主可见)

评论内容:

  登录  注册

[使用Ctrl+Enter键快速提交评论]

0 793102 cp7I96hCkVI=