Oracle游标常用属性

数据库 Oracle
Oracle数据库中的游标我们经常用到,下文对Oracle游标常用属性作了详细的叙述,希望对您学习游标方面能有所帮助。

Oracle游标相信大家都不陌生,下面就为您详细介绍Oracle游标的常用属性,如果您对Oracle游标方面感兴趣的话,不妨一看。

Oracle游标常用属性:

%FOUND:变量***从游标中获取记录的时候,在结果集中找到了记录。

%NOTFOUND:变量***从游标中获取记录的时候,在结果集中没有找到记录。

%ROWCOUNT:当前时刻已经从游标中获取的记录数量。

%ISOPEN:是否打开。

  1. Declare  
  2.  
  3.  /* 定义静态游标 */  
  4.  
  5.  Cursor emps is  
  6.  
  7.  Select * from employees where rownum<6 order by 1;  
  8.  
  9.  Emp employees%rowtype;  
  10.  
  11.  Row number :=1;  
  12.  
  13. Begin  
  14.  
  15.  Open emps; /* 打开静态游标 */  
  16.  
  17.  Fetch emps into emp; /* 读取游标当前行 */  
  18.  
  19.  Loop  
  20.  
  21.  If emps%found then  
  22.  
  23.    Dbms_output.put_line('Looping over record '||row|| ' of ' || emps%rowcount);  
  24.  
  25.    Fetch emps into emp;  
  26.  
  27.    Row :row + 1;  
  28.  
  29.  Elsif emps%notfound then  
  30.  
  31.    Exit;   
  32.  
  33.  End if;  
  34.  
  35.  End loop;  
  36.  
  37.  If emps%isopen then  
  38.  
  39.  Close emps;   /* 关闭游标 */  
  40.  
  41.  End if;  
  42.  
  43. End;  
  44.  
  45. /  
  46.  

 
 

 


 【编辑推荐】

Oracle创建表和索引

教您如何实现Oracle重建索引

全面解析Oracle文件系统

当前Oracle系统时间的查询方法

ORACLE系统表和数据字典视图

 

 

责任编辑:段燃 来源: 互联网
相关推荐

2010-11-16 15:40:21

oracle游标

2010-11-16 15:11:52

Oracle隐式游标

2010-04-21 15:02:50

Oracle使用游标

2010-04-21 15:10:35

Oracle游标

2010-11-16 14:59:39

Oracle显式游标

2010-05-07 12:07:08

Oracle 多层游标

2010-04-21 14:53:46

Oracle游标

2010-05-06 11:02:26

Oracle游标

2010-11-16 14:53:02

Oracle游标表达式

2015-03-03 15:59:25

Android开发属性

2010-08-24 13:55:38

DIVstyle

2010-04-21 15:22:54

Oracle游标

2010-04-09 09:07:43

Oracle游标触发器

2010-04-26 13:54:04

Oracle查看

2010-10-28 16:46:23

查询Oracle数据库

2010-04-02 08:42:32

Oracle 游标

2009-01-11 08:16:00

自适应游标共享新特性Oracle 11g

2015-03-03 09:19:12

UIScrollVie

2011-04-14 13:29:42

Oracle日期转换

2010-04-26 14:12:23

Oracle使用游标触
点赞
收藏

51CTO技术栈公众号