zoukankan      html  css  js  c++  java
  • ORACLE1.22 %type %rowtype

    select * from tt3

    -- 20年后多少岁

     

    declare

       age tt3.age%type;

       dif tt3.age%type;

    begin

       select age into age from tt3 where id=1;

       dif := 20; -- 设置一个年龄差

       age:= age + dif;

       dbms_output.put_line(age);

    end;

    ------------------------------

    declare

       age tt3.age%type;

       dif tt3.age%type :=20; -- 设置一个年龄差

    begin

       select age into age from tt3 where id=1;

       age:= age + dif;

       dbms_output.put_line(age);

    end;

    -------------------

    declare

       age tt3.age%type;

       dif tt3.age%type :=20; -- 设置一个年龄差

    begin

       select age+dif into age from tt3 where id=1;

       dbms_output.put_line(age);

    end;

    -------------------

    declare

       age tt3.age%type;

       dif age%type :=21; -- 设置一个年龄差

    begin

       select age+dif into age from tt3 where id=1;

       dbms_output.put_line(age);

    end;

     

     select * from tt3 where id=1;

     

     

    -- 不需要一个字段一个字段写出来

    declare

      my_user tt3%rowtype;

    begin

       select * into my_user from tt3 where id=1;

       dbms_output.put_line( my_user.user_name );

    end;

     

    declare

      my_user tt3%rowtype;

      show_message varchar2(200);

    begin

       select * into my_user from tt3 where id=1;

       show_message:= my_user.user_name || '住在' || my_user.city;

       dbms_output.put_line( show_message );

    end;

    ----------

    declare

      my_user tt3%rowtype;

      show_message varchar2(200);

    begin

       select * into my_user from tt3 where id=1;

       show_message:= my_user.user_name || '住在' || my_user.city||',年龄:'||my_user.age||'岁';

       dbms_output.put_line( show_message );

    end;

     

    ---------------

    declare

      my_user tt3%rowtype;

      show_message varchar2(200);

      dif number :=20;

    begin

       select * into my_user from tt3 where id=1;

       show_message:= my_user.user_name || '住在' || my_user.city||',年龄:'||my_user.age||'岁,二十年后'||(my_user.age+dif);

       dbms_output.put_line( show_message );

    end;

  • 相关阅读:
    连接sql sever2008数据库出现了无法连接到数据库引擎问题解决
    关于ssh的一些问题
    23.Xcode中常用的快捷键操作
    22.上传app一些相关问题
    20.cocoapods的安装和使用
    19. UIAlertController 提示框获取文本内容,打印控制台上
    18.safari 安装后flash还是提示安装 flash,视频不能播放
    17.iOS App设置icon,启动图,App名称的方法
    16.iOS APP图标和启动画面尺寸
    15.Xcode8 升级遇到的问题
  • 原文地址:https://www.cnblogs.com/wyj1212/p/8649163.html
Copyright © 2011-2022 走看看