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.
- • 如何用lotusscript调用代理
- • 各位推荐一本AJAX的书吧
- • 做练习时。发现一个有关问题，找不到原因，求帮忙，多谢
- • 一个小疑点，求教！
- • 怎么让TextBox不获得焦点
- • enum门类, 里面的元素可以拿出来用吗
- • 使用ASP实现网站的“目录树”管理的代码_应用技巧
- • 有关seo的厚黑学三个层次梯度分析_有关smartbook 琦基U1000不能充电的事宜
- • myeclipse 6.0 安装SVN插件 -
- • 欢迎访问我的网站——翔宇亭IT乐园 -