oracle oracle中静态游标与动态游标的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1815722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 19:32:36  来源:igfitidea点击:

Difference between Static Cursor Vs Dynamic Cursor in oracle

oracle

提问by P Sharma

Hi Can any body describe, what are the differences between static cursor and dynamic cursor with examples.

嗨,任何正文都可以通过示例来描述静态游标和动态游标之间的区别。

采纳答案by Guru

Check ref cursors. For example code, check here. The difference is ofcourse in the ability and implementation.

检查引用游标。例如代码,在这里检查。区别当然在于能力和执行力。

回答by vikas

?A Static Cursor doesn't reflect data changes made to the DB once the ResultSet has been created whereas a Dynamic Cursor reflects the changes as and when they happen.

? 静态游标不会反映在创建 ResultSet 后对数据库所做的数据更改,而动态游标则反映更改发生时的更改。

?A Static Cursor is much more performant than a Dynamic Cursor as it doesn't require further interaction with the DB server.

?静态游标的性能比动态游标高得多,因为它不需要与数据库服务器的进一步交互。

?A static cursor supports both Relative and Absolute Positioning whereas a Dynamic Cursor supports only Relative Positioning.

?静态游标支持相对定位和绝对定位,而动态游标仅支持相对定位。

?A Static Cursor can be used for Bookmarking purposes as the data returned is static whereas a Dynamic Cursor can't be used for the same

?静态游标可用于书签目的,因为返回的数据是静态的,而动态游标不能用于相同的目的

回答by Abdulaziz

Static

静止的

The complete result set of a static cursor is built in tempdb when the cursor is opened. A static cursor always displays the result set as it was when the cursor was opened. Static cursors detect few or no changes, but consume relatively few resources while scrolling.

静态游标的完整结果集在游标打开时内置在 tempdb 中。静态游标始终显示打开游标时的结果集。静态游标检测到很少或没有变化,但在滚动时消耗的资源相对较少。

Dynamic

动态的

Dynamic cursors are the opposite of static cursors. Dynamic cursors reflect all changes made to the rows in their result set when scrolling through the cursor. The data values, order, and membership of the rows in the result set can change on each fetch. All UPDATE, INSERT, and DELETE statements made by all users are visible through the cursor.

动态游标与静态游标相反。动态游标反映滚动游标时对其结果集中的行所做的所有更改。结果集中行的数据值、顺序和成员资格可以在每次获取时更改。所有用户所做的所有 UPDATE、INSERT 和 DELETE 语句都可以通过游标看到。

From http://technet.microsoft.com/en-us/library/ms191179.aspx

来自 http://technet.microsoft.com/en-us/library/ms191179.aspx

回答by M.Mahesh Reddy

static cursor refers always one work area associated with cursor. where as ref cursor refers different work area in memory. ref cursor is used to declare a cursor with out select statement.

静态游标总是指与游标相关联的一个工作区。其中引用光标指的是内存中的不同工作区。ref cursor 用于声明一个没有 select 语句的游标。