• Oracle语句块PL/SQL循环判断


    -

    --pl/sql Procedural Language /sql
    --被数据库编译保存,由用户调用
    --程序块
    /*
    语法
        Declare – 声明变量
            --声明变量
            Age int; //没有默认值的变量
            Age2 int :=  0;
    begin
        //写正常的处理语句
        dbms_output.put_line(‘Hello’);
    end ;
    / -写一个就是执行
    */
    --一个hello world 的程序块
    declare
    age INTEGER:=3;
    begin
    DBMS_OUTPUT.PUT_LINE('hello world');
    DBMS_OUTPUT.PUT_LINE('age=3');
    end;
    --输出默认关闭手工打开
    set serveroutput on;
    --控制语句
    
    /*
    if then
    elsif then
    else
    end if
    */
    --一个if的语句块
    declare
    age integer:=3;
    begin
    if age=1 then
    
    DBMS_OUTPUT.PUT_LINE('age=1');
    elsif age=2 then
    DBMS_OUTPUT.PUT_LINE('age=2');
    else
    DBMS_OUTPUT.PUT_LINE('age=3');
    end if;
    end;
    
    --循环
    declare
    i int:=1;
    begin
    loop
    exit when i>10;
    DBMS_OUTPUT.PUT_LINE('编号为'||i);
    i:=i+1;
    end loop;
    end;

  • 相关阅读:
    跨域资源共享 CORS 详解
    C# 每月第一天和最后一天
    jexus http to https
    ASP.NET MVC 路由学习
    jexus
    centos7 添加开机启动项
    jexus docker
    HTTP2.0新特性
    jexus配置支持Owin
    Autofac Named命名和Key Service服务
  • 原文地址:https://www.cnblogs.com/xiaweifeng/p/3675589.html
Copyright © 2020-2023  润新知