zoukankan      html  css  js  c++  java
  • PL/SQL基本语法


    set serveroutput on;
    --引用型变量
    declare    
      2  pname emp.ename%type;
      3    psal emp.sal%type;
      4    begin
      5         select ename,sal into pname,psal from emp
      6               where empno=7844;
      7         dbms_output.put_line(pname||'的薪水是'||psal||'元');
      8    end;
      9  /


    --记录型变量
    declare
      2      emp_rec emp%rowtype;
      3      begin
      4      select * into emp_rec from emp where empno = 7499;
      5      dbms_output.put_line(emp_rec.ename||'的薪水是:'||emp_rec.sal);
      6      end;
      7  /



    --if语句
    set serveroutput on;
    accept num prompt '请输入一个数字:';--num为地址
    declare
    pnum number := #   
        begin
        if pnum = 0 then dbms_output.put_line('您输入数字为0');
        elsif pnum = 1 then dbms_output.put_line('您输入数字为1');
        elsif pnum = 2 then dbms_output.put_line('您输入数字为2');
        else dbms_output.put_line('其他数字');
        end if;
        end;
    /   

  • 相关阅读:
    Gengxin讲STL系列——Set
    理解Python的With语句
    Python中Non-ASCII character 'xe7' in file的问题解决
    gnome-terminal的一些调整
    硬盘的CHS寻址
    Wiz发布cnblog笔记
    cygwin安装man手册
    linux命令行使用
    小步前进
    学习的感觉真好
  • 原文地址:https://www.cnblogs.com/dylq/p/9831988.html
Copyright © 2011-2022 走看看