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.
- • vb源码-金夫人电子相册制造系统
- • 存储过程中的倒叙查询兑现不了么？desc
- • 施用JPA注解，持久化java.util.Map
- • spring跟jbpm的详细配置
- • MDX语句请问
- • 软件设计师考前练习一
- • 解决time_wait强制关闭socket_应用技巧
- • java文件对话框过滤特定文件类型示例_java
- • Asp.Net把word文件转换为html文件 -
- • HttpServlet详解 - 孙革兵的java小家