Oracle中for语句的使用

set serveroutput on
declare 
  total int;
begin 
  total:=0;
  for i in reverse 1..10 loop
    if mod(i,2)=0 then 
      dbms_output.put_line('total:='||total||'+'||i);
      total:=total+i;
    end if;
  end loop;
  dbms_output.put_line('10以内偶数的和是'||total);
end;

 

 

 

posted on 2020-03-27 10:59  癫狂编程  阅读(254)  评论(0编辑  收藏  举报

导航

好的代码像粥一样,都是用时间熬出来的