1. 合并 firstname, lastname.

   1:  declare
   2:      v_first_name    varchar2(255);
   3:      v_last_name        varchar2(255);
   4:  begin
   5:      select first_name, last_name
   6:        into v_first_name, v_last_name
   7:        from student
   8:       where student_id = 777;
   9:      
  10:      dbms_output.put_line('Student Name: ' || v_first_name || ' ' || v_last_name);
  11:  exception
  12:      when no_data_found then
  13:          dbms_output.put_line('There is no data');
  14:  end;
  15:  /
  16:  show errors;

2. 使用替代变量, 交互内容, 个人感觉替代变量并不常用, 真正生产情况时, 那有那么多人来输入替代变量的值啊.

/*
* 测试替代变量
* sv_student_id, sv 个人理解是 system value的意思
*/ declare
v_student_id number := &sv_student_id;
v_first_name varchar2(255);
v_last_name varchar2(255);
begin
select first_name, last_name
into v_first_name, v_last_name
from student
where student_id = &sv_student_id; dbms_output.put_line('Student Name: ' || v_first_name || '' || v_last_name);
exception
when no_data_found then
dbms_output.put_line('There is no student');
end;
/
show errors;

注意: 运行以上例子2 时, 系统会给出提示, 让你输入 student_id 的值, 然后会显示 old_value, new_value

最新文章

  1. Error: pathspec '*' did not match any file(s) known to git.
  2. 数据字典生成工具之旅(3):PowerDesign文件组成结构介绍及操作
  3. MongoDB创建数据库和集合命令db.createCollection详解(转)
  4. 【C语言】12-指向一维数组元素的指针
  5. 删除下标为n的数组值
  6. Marriage Match IV---hdu3416(spfa + Dinic)
  7. cmd下windows批处理,获取当前系统时间,生成日志文件名
  8. cocos2d-x触屏事件(单点触屏)
  9. IAR Embedded Workbench 破解方法+工具+授权文件
  10. CSS入门教程——定位(positon)
  11. The following classes could not be found: - android.support.v7.internal.widget.ActionBarOverlayLayou解决方案
  12. 华为OJ之最长公共子序列
  13. 庞玉栋:浅谈seo优化对于网站建设的重要性
  14. Go语言中定时器cron的基本使用
  15. [java] 数据处理
  16. 无限极分类php实现—查子孙树、家谱树
  17. 124、@JavascriptInterface
  18. Struts2重新学习之自定义拦截器(判断用户是否是登录状态)
  19. AT994 【11の倍数】
  20. weblogic安装使用: Could not Create the Java Virtual Machine

热门文章

  1. SVN-两种存储方式的比较(BDB vs. FSFS)
  2. HTML5 移动端如何使用css让百分比布局的弹窗水平和垂直方向上居中
  3. php使用curl请求数据(采集数据)
  4. ES6 变量解构用法
  5. 关于苹果开发证书失效的解决方式(2016年2月14日Failed to locate or generate matching signing assets)
  6. [Exception Android 22] - Could not find com.android.support:design:23.1.1
  7. Hibernate映射set与List
  8. bootstrap学习笔记一 登录水平表单
  9. 【转】可在广域网部署运行的即时通讯系统 -- GGTalk总览(附源码下载)
  10. VMware配置网络的3种方式:NAT、Host-Only、Bridged