游标(cursor )是什么?

Private SQL Area

 A private SQL area holds information about a parsed SQLstatement and other session-specific information for processing. When a serverprocess executes SQL or PL/SQL code, the process uses the private SQL area tostorebind variablevalues, query execution state information, and query execution work areas.

A cursor is a name or handle to a specific private SQL area. As shown inFigure 14-5,you can think of a cursor as a pointer on the client side and as a state on theserver side. Because cursors are closely associatedwith private SQL areas, the terms are sometimes usedinterchangeably

Figure 14-5 Cursor



====================================================================================================================================

永久内存区域:这里存放了相同SQL语句多次执行时都需要的一些游标信息,比如绑定变量信息、

The persistent area—This areacontains bindvariable values1

 

Cursor state

 

=++=+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

CURSOR(私有SQL 区)就是一个句柄,即指针或引用,指向sql私有区(一个用户的能打开的cursor数由参数open_cursors决定)【确切说,指向sql私有区里的固定部分(The persistentarea)的开始地址,该地址也是sql私有区的开头地址】。然后sql私有区有指针指向共享sql区。私有sql区有两个部分

固定部分:绑定信息,数据结构信息,指针。随session的创建而创建,结束而释放(pmon)

动态部分:执行sql的中间结果集,如多表联查,排序。随sql的创建而创建,结束而释放。

Cursors

A cursor is a handle or name for a private SQL area—an area in memory in which a parsedstatement and other information for processing the statement are kept.

Although most Oracle users rely on the automatic cursorhandling of the Oracle utilities, the programmatic interfaces offer applicationdesigners more control over cursors. In application development, a cursor is anamed resource available to a program and can be used specifically to parse SQLstatements embedded within the application.

Each user session can open multiplecursors up to the limit set by the initialization parameterOPEN_CURSORS.However, applications should close unneeded cursors to conserve system memory.If a cursor cannot be opened due to a limit on the number of cursors, then thedatabase administrator can alter theOPEN_CURSORS initializationparameter.

Some statements (primarily DDL statements)require Oracle to implicitly issue recursive SQL statements, which also requirerecursive cursors. For example, a CREATETABLEstatement causes many updates to various data dictionary tables to record thenew table and columns. Recursive calls are made forthose recursive cursors; one cursor can run several recursive calls. Theserecursive cursors also use shared SQL areas.

参考:http://docs.oracle.com/cd/B19306_01/server.102/b14220/sqlplsql.htm#i7579

24 SQL, PL/SQL, and Java

====================================================================================================================================


疑问:

oracle服务端的shared pool上的父游标和子游标也是这个意义吗?


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值