您当前的位置: 首页 >  童心同萌 oracle

Oracle中loop语句的使用

童心同萌 发布时间:2019-02-13 12:11:23 ,浏览量:3

set serveroutput on
declare
  num int;
  total int;
begin
  num:=0;
  total:=0;
  loop 
    num:=num+1;
    total:=total+num;
    exit when num=5;
  end loop;
  dbms_output.put_line('前5个自然数的和是'||total);
end;

 

关注
打赏
查看更多评论

童心同萌

暂无认证

  • 3浏览

    0关注

    87博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录