`

What Is A Cursor And Why Should You Use A Cursor In Sql?

    博客分类:
  • sql
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

分享到:
评论

相关推荐

    What Is ChatGPT Doing ... and Why Does It Work.pdf

    《ChatGPT在做什么...以及为什么它有效》 这本书由斯蒂芬·沃尔夫勒姆(Stephen Wolfram)撰写,探讨了ChatGPT的工作原理及其为何能成功运作。沃尔夫勒姆是计算科学领域的权威,他的公司Wolfram Media出版了这本书...

    SQL and Relational Theory: How to Write Accurate SQL Code

    A special feature of this edition is a new appendix on NoSQL and relational theory.Could you write an SQL query to find employees who have worked at least once in every programming department in the ...

    SQL.and.Relational.Theory.How.to.Write.Accurate.SQL.Code.3rd.Edition

    In this book, Chris Date explains relational theory in depth, and demonstrates through numerous examples and exercises how you can apply it to your use of SQL. This third edition has been revised, ...

    Addison.Wesley.C.Plus.Plus.Coding.Standards.101.Rules.Guidelines.and.Best.Practices.Oct.2004.eBoo.chm

    Why should you use STL vector and string instead of arrays? How do you choose the right STL search or sort algorithm? What rules should you follow to ensure type-safe code? Whether you're working ...

    SSD7 选择题。Multiple-Choice

    (c) typing a syntactically correct SQL query that uses column and table names similar to the correct column and table names in a database (d) writing an English description of the data that the user...

    expert-brief-architecture.pdf

     Why a security architecture, and what is the business case? Is it important to have a security architecture, or is it just another new hype?  Who does it give added value to?  Are there ...

    Pro Oracle SQL

    You’ll also understand how SQL is optimized for working in sets, and that the key to getting accurate results lies in making sure that queries ask clear and precise questions., , What’s the bottom-...

    微软内部资料-SQL性能优化2

    and page faults are not allowed at this level or above, most device drivers use non-paged pool to assure that they do not incur a page fault. Represented by Memory: Pool Nonpaged Bytes, typically ...

    Learn CSS in One Day and Learn It Well (Volume 2)

    Each CSS chapter comes with an end-of-chapter exercise where you get to practice the different CSS properties covered in the chapter and see first hand how different CSS values affect the design of ...

    What is a matroid.pdf

    WHAT IS A MATROID? JAMES OXLEY Abstract. Matroids were introduced by Whitney in 1935 to try to capture abstractly the essence of dependence. Whitney’s definition embraces a surprising diversity of ...

    微软内部资料-SQL性能优化3

    It is up to the application to define what consistency means, and isolation in some form is needed to achieve consistent results. SQL Server uses locking to achieve isolation. Definition of ...

    Beginning T-SQL with Microsoft SQL Server 2005 and 2008

    You may already have a basic idea of what SQL is used for, but you may not have a good understanding of the concepts behind relational databases and the purpose of SQL. This book will help you build a...

    Hands-On Machine Learning with Scikit-Learn and TensorFlow PDF

    In this chapter we will start by clarifying what Machine Learning is and why you may want to use it. Then, before we set out to explore the Machine Learning continent, we will take a look at the map ...

    微软内部资料-SQL性能优化5

    Each index row in node pages contains an index key (or set of keys for a composite index) and a pointer to a page at the next level for which the first key value is the same as the key value in the ...

Global site tag (gtag.js) - Google Analytics