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;

转载于:https://www.cnblogs.com/wyj1212/p/8649163.html

ORACLE1.22 %type %rowtype相关推荐

  1. Oracle 自定义类型TYPE(subtype, type object, type body, type table) 用法

    原 ORACLE 自定义类型 type/ object 2017年03月28日 13:58:23 tan1012194073 阅读数:5999 版权声明:本文为博主原创文章,未经博主允许不得转载. h ...

  2. Oracle PL/SQL存储过程对象类型Object type详解 create type obj_type as object, create table tab_name of obj_type

    原 oracle 对象类型 object type 置顶 2011年06月13日 18:00:00 oypj2010 阅读数:3453 /* 对象类型属于用户自定义的一种复合类型,它封装了数据结构和拥 ...

  3. Java Web学习总结(22)——使用kaptcha生成验证码

    kaptcha是一个简单好用的验证码生成工具,通过配置,可以自己定义验证码大小.颜色.显示的字符等等.下面就来讲一下如何使用kaptcha生成验证码以及在服务器端取出验证码进行校验. 一.搭建测试环境 ...

  4. 【Oracle】TYPE定义的数据类型

    目录 一.TYPE定义的数据类型 1.1 语法 1.2 定义RECORD记录 1.3 定义TABLE类型 1.3.1 定义单列多行的数据集合 1.3.2 定义多列多行的数据集合 二.%TYPE %RO ...

  5. mysql explain type_MySQL explain type详解

    SQL性能调优的依据就是explain,其中type对结果影响最大,本文详细介绍了一下各个不同的type所表示的意义 ps: 网上有很多文档,但是有的并不能复现,所以再仔细研究了一下,并实验了结果 版 ...

  6. 如何快速定位 elastic search 运行出现的 bug HTTP/1.1 400 Bad Request type is missing VALUE_NUMBER_INT

    文章目录 前言 HTTP/1.1 400 Bad Request type is missing VALUE_NUMBER_INT ES BUG 快速定位 前言 因为最近项目上线,正好碰到了elast ...

  7. [转]SQLServer和Oracle,存储过程区别,常用函数对比

    本文转自:http://www.cnblogs.com/neru/archive/2011/08/18/2144049.html 以前一直用sqlserver,只有很少的一点oracle的经验,现在要 ...

  8. 从零开始学习Oracle—安装及删除

    Oracle9i的安装与删除 -.要求:    ORACLE9i  9.0.1  空间1.76G    ORACLE9i  9.0.2  空间2.86G     事务处理 --  增 删除 修改频繁 ...

  9. oracle PL/SL编程基础

    .了解PL/SQL数据类型 .掌握PL/SQL控制结构 .了解PL/SQL中异常处理 .掌握游标的使用 Pl/SQL简介 提高应用程序的运行性能, 提供模块化的程序设计, 自定义标示符, 具有过程语言 ...

最新文章

  1. Alpha 冲刺报告(8/10)
  2. Verilog中的二维数组及其初始化
  3. DotNetNuke: System.Security.Cryptography.CryptographicException: Bad Data
  4. 今天,小程序正式支持 SVG
  5. 科研期刊分区 控制期刊介绍 领域大牛
  6. 10年前腾讯微信后台第一天提交的代码曝光!
  7. linux ----Inode的结构图
  8. CStatic类的GDI双缓冲绘图
  9. 禅道备份功能_禅道备份处理
  10. 单尺度Retinex算法学习
  11. 安卓手机无线投屏电脑 三种方法轻松搞
  12. 【滤波器】基于多种滤波器实现信号去噪含Matlab源码
  13. facebook轮播视频_如何设置Facebook Messenger Messenger视频通话
  14. Peer Pressure(博弈论+机制设计) 论文阅读笔记
  15. 零零后Java架构师斗胆挑战下一个传智播客,你怎么看?
  16. 交换机端口与MAC绑定
  17. 《代码整洁之道》阅读笔记——第12章:迭进
  18. 小白都能看懂的关于Mixins机制的理解
  19. 十分钟搞懂手机号码一键登录
  20. 实战-H3C交换机之Web界面

热门文章

  1. 微软回应 CIA 漏洞攻击 Win10 问题:正在研究维基解密报告
  2. VS2005调试ASP.NET出现未能开始侦听端口解决办法
  3. PostgreSQL 11 100亿 tpcb 性能测试 on ECS
  4. 批量任务体现多线程的威力!
  5. 小论Java类变量的隐私泄露
  6. Java Web之POI操作Excel2016模板
  7. D1net阅闻:WhatsApp正式推出Windows和Mac本地桌面应用
  8. centos下查看网卡,主板,CPU,显卡,硬盘型号等硬件信息
  9. struts2:struts.xml配置文件详解
  10. Eclipse常用功能键