欢迎来到Doc100.Net免费学习资源知识分享平台!
您的位置:首页 > 程序异常 >

what is a cursor and why should you use a cursor in sql

更新时间: 2014-01-05 02:07:16 责任编辑: Author_N1

 

What Is A Cursor And Why Should You Use A Cursor In Sql?
Cursor in the SQL is the private working area, in fact every time you write a query to fetch data from the database an internal cursor is developed that fetch the data from the database and hold the data in it and then displays it to you.

Let me give you example, it is like a counter of pharmacy where you are allowed to present your prescription and not allowed to go in by your self and collect the medicine by your own. Same is the case of cursor because in order to minimize your interaction with the database it interact with database itself and you only deal with the cursor, but the whole process is so fast in SQL that you feel as if you are interacting with database directly and fetching direct from Tables.

Now the answer to your second part of question that why we should use cursors, some times you need to fetch data according to your choice in PL/SQL so you define explicit cursor, with explicit cursor you can combine LOOPS to get the data of you choice and even repeatedly same data as well. There are four phases of any cursor internal or external, DECLARE, OPEN , FETCH AND THEN CLOSE.



原文:http://science.blurtit.com/75320/what-is-a-cursor-and-why-should-you-use-a-cursor-in-sql

上一篇:上一篇
下一篇:下一篇

 

随机推荐程序问答结果

 

 

如对文章有任何疑问请提交到问题反馈,或者您对内容不满意,请您反馈给我们DOC100.NET论坛发贴求解。
DOC100.NET资源网,机器学习分类整理更新日期::2014-01-05 02:07:16
如需转载,请注明文章出处和来源网址:http://www.doc100.net/bugs/t/5836/
本文WWW.DOC100.NET DOC100.NET版权所有。