光标的使用.pptVIP

  • 57
  • 0
  • 约4.97千字
  • 约 34页
  • 2017-04-05 发布于江苏
  • 举报
光标的使用

第十二章 光标的使用 光标的概念 Oracle 光标是一种用于轻松的处理多行数据的机制。 当 PL/SQL 光标查询返回多行数据时,这些记录组被称为结果集。 Oracle 将这种活动集存储在您创建的显示定义的已命名的光标中。 没有光标, Oracle 开发人员必须单独地、显式地取回并管理光标查询选择的每一条记录。 12.1 光标的定义与使用 显式光标处理需四个 PL/SQL步骤: cursor 光标名称 is 查询语句; open 光标名称; Fetch 光标名称 into 变量列表; Close 光标名称; 12.1 光标的定义与使用 例1. declare cursor c1 is select ename, sal from emp where rownum11; v_ename varchar2(10); v_sal number(7,2); begin open c1; fetch c1 into v_ename, v_sal; while c1%found loop dbms_output.put_line(v_ename||to_char(v_sal) ); fetch c1 into v_ename, v_sal; end loop; close c1; end; 1

文档评论(0)

1亿VIP精品文档

相关文档