• PLSQL程序流程


     

    IF语句结构:

       if(条件表达式)-

         -then-

         -执行语句;-

       -end;

    IF-THEN-ELSE语句结构:

       if(条件表达式)-

        -then-

        -执行语句;-

    -else-

    -执行语句;-

       end;

    ELSIF语句:

       if(条件表达式)-

        -then-

        -执行语句;-

    -elsif-

    -执行语句;-

    -elsif-

    -执行语句;-

    -else-

    -执行语句;-

       end;

    注意:elsif语句是顺序执行的,各个执行条件之间是互斥的关系,在使用该语句是需要注意条件的顺序关系。

    IF嵌套:

       if(条件表达式)-

    -then-

     (-执行语句;-)

     If (条件表达式)-

       -then

       -执行语句;-

       -else-

       -执行语句;-

     end;

       -else-

        -then-

        -执行语句;-

       end;

    CASE语句:

    Case 的两种行为方式。

    一,简单的case语句,case  选择器 when  xxx  then  xxx

    二,搜索式  case  when xxx then xxx 这个是没有选择器的。

    循环控制语句:

    1.基本循环机构:

      loop

    执行语句

      end loop;

    2.While循环:

      while vars<=12 loop

    执行语句;

      end loop;

    3.for循环:

      for i in 1..10 loop

    执行语句;

      end loop;

      i1-10循环执行

    中断控制

    exit 退出 ②exit when(先执行在判断)

    顺序控制

    continue 继续 ②continue when(先执行在判断)

    NULL语句:

     Null是一种判断语句,在流程控制中,意味着什么也不做

     If name=’sun’

      then

       dbms_output.put_line(‘name=’||name);

      else

       null;--

       Null起到了屏蔽异常的作用,不需要处理异常的场合就可以使用null不做任何事情。

     end;

  • 相关阅读:
    Java开发必备工具 ------------工欲善其事,必先利其器(补充+1)
    我的第一篇博客
    GPD mircoPC linux系统安装
    如何简单的编译v8动态库
    如何让FasterTransformer支持动态batch和动态sequence length
    合并多个tensorflow模型的办法
    IDEA优化配置
    Easyui中select下拉框(多选)的取值和赋值
    Windows下搭建Nacos及Seata
    SpringBoot打包成jar运行脚本
  • 原文地址:https://www.cnblogs.com/sun-chao/p/6343623.html
Copyright © 2020-2023  润新知