zoukankan      html  css  js  c++  java
  • Oracle 学习---- 练习语法 循环( loop end loop; for ;while; if elsif end if )

    /*--set serveroutput on;
    declare
    mynum number(3) :=0;
    tip varchar2(10):='结果是 ';
    begin
    mynum:=10+100;
    dbms_output.put_line(tip || mynum);
    end;
    /*/

    /*declare
    pername temp.name%type;
    psal temp.sal%type;
    begin
    select name,sal into pername,psal from temp where keycode=3;
    dbms_output.put_line('3号员工的姓名是:'|| pername || ',工资是:'|| psal);
    end;
    /*/

    /*declare
    emp_name temp%rowtype;
    begin
    select * into emp_name from temp where keycode=2;
    dbms_output.put_line('3号员工姓名:' || emp_name.name || ',年龄:' || emp_name.sal);
    end;
    /*/

    /*declare
    pday varchar2(20);
    begin
    select to_char(sysdate,'day')into pday from dual;
    dbms_output.put_line('今天是' || pday);

    if pday in ('星期六','星期日') then
    dbms_output.put_line('休息日');
    else dbms_output.put_line('工作日');
    end if;

    end;
    /
    */
    /*
    declare
    age number(3) := &age;
    begin
    if age < 16 then
    dbms_output.put_line('你是未成年人!');
    elsif age < 30 then
    dbms_output.put_line('你是青年人!');
    elsif age < 60 then
    dbms_output.put_line('你是奋斗人');
    elsif age < 80 then
    dbms_output.put_line('你是享受人');
    else
    dbms_output.put_line('未完再继');
    end if;
    end;
    /*/
    /*
    declare
    i number(2) :=1;
    begin
    loop
    exit when i >10;
    dbms_output.put_line(i);
    i :=i+1;
    end loop;
    end;
    /
    */
    /*
    declare
    i number(2) :=1;
    begin
    while i<11
    loop
    dbms_output.put_line(i);
    i:=i+1;
    end loop;
    end;
    / */

    /*declare
    i number(2) := 20;
    begin
    for i in 20 .. 30
    loop
    dbms_output.put_line(i);
    end loop;
    end;
    /*/

  • 相关阅读:
    Twain文档链接
    JavaScript 事件绑定函数
    VC++ 字符串Dword、LPSTR、LPWSTR、LPCSTR、LPCWSTR、LPTSTR、LPCTSTR
    Sciter参考资料
    C++对windows控制面板的操作
    C++ Msi函数判断应用是否已经安装
    WMware 安装 Mac OSX
    C++文件流操作
    jquery弹出层
    CSS3 水平翻转
  • 原文地址:https://www.cnblogs.com/ln-qiqi/p/10675378.html
Copyright © 2011-2022 走看看