zoukankan      html  css  js  c++  java
  • Oracle 的几种循环方式介绍

    1 Oracle 中的Goto 用法:

    declare
    x number;
    begin
      x:=10; --定义的初始值
      <<repeat_loop>> --循环点
      x:= x-2; -- 循环的处理条件
      dbms_output.put_line('结果x是:'||x); -- 循环一次打印一次
      if x>0 then
        GOTO repeat_loop; -- 再次循环
     
       else if x<0 then
         dbms_output.put_line('数值是x:'||x);
         end if;
      end if;
    end;

    2 Oracle中的for循环用法:

    declare
    begin
       for i in 2..10 Loop
         dbms_output.put_line('结果i是:'||i);
      end loop;
    end;

    3 Oracle中while的循环用法:

    declare
    x number;
    begin
     x := 5 ;
     while x>0 loop
       x := x-1; -- 循环的每次处理
     if x = 3 then
       return; -- 跳出循环
     else
        dbms_output.put_line('x的值是'||x);
       end if;
     end loop; 
    end;

    4 Oracle 中的loop循环用法:

    declare
    x number;
    begin
      x:=0;
      loop
        x := x+1;
        exit when x >5 ; -- x大于5是终止
         dbms_output.put_line('结果x是two:'||x);
      end loop;
      end;
    好的代码像粥一样,都是用时间熬出来的
  • 相关阅读:
    PHP登入
    PHP注册
    PHP数据访问
    php实现人员的权限管理
    PHP实现简单的评论与回复功能还有删除信息
    php文件的管理
    文件的操作
    文件上传及预览
    ajax分页
    三级联动
  • 原文地址:https://www.cnblogs.com/jijm123/p/15762045.html
Copyright © 2011-2022 走看看