SYS_REFCURSOR 和 CURSOR 的区别

沧海叶 2009-10-26 02:06:31
如题:
不知道什么 原因我用 SYS_REFCURSOR定义的游标不能进行close和OPEN。
而用CURSOR是可以的。
...全文
281 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
shiyiwan 2009-10-26
  • 打赏
  • 举报
回复
No difference. Big difference.

Depends on from where you look at the thing called a "cursor".

Inside Oracle itself (the SQL Shared Pool) - no difference at all. Every single SQL parsed becomes a cursor. Oracle's SQL engine has no concept of ref cursor, or any other type of cursor. These are all just cursors. Period.

From the client language (PL/SQL, Java, C#, etc) there are differences. They implement "interfaces" to that cursor in the SQL engine.

PL/SQL specifically provides a couple of such interfaces:
- an implicit cursor (you simply code SQL directly in PL, and it does the cursor "thing" for you)
- an explicit cursor (you code the cursor definition, and the fetches from the cursor)
- a DBMS_SQL cursor (the full SQL cursor interface - complex, but with a lot of additional goodies)
- a reference cursor (a reference/handle/pointer to a cursor that is intended to be passed to an external client for use)

Please refer:
http://forums.oracle.com/forums/thread.jspa?threadID=329109
沧海叶 2009-10-26
  • 打赏
  • 举报
回复
SYS_REFCURSOR 和 CURSOR 的有什么区别呢?
沧海叶 2009-10-26
  • 打赏
  • 举报
回复
具体的代码非常长。是这样的。我所定义的游标是需要进行两次循环的。
第一次循环结束后还要重头循环一次。所以要用open打开。
vc555 2009-10-26
  • 打赏
  • 举报
回复
在使用时无需open可以close,定义时需指定open词。
具体代码呢?

3,490

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 高级技术相关讨论专区
社区管理员
  • 高级技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧