- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Explain the scenario in which CURSOR should be used over a standalone SELECT statement?
The standalone SELECT statement is generally used when we use a primary or an alternate key in the WHERE clause. Therefore, In this case we are certain that the standalone select statement will return only one row since the primary key cannot have a duplicate value (multiple rows).
If we want to query the database using a non-unique key which could return multiple rows from a DB2 table, we have to use a cursor to handle the multiple rows returned. We can access the cursor in a loop to read each row data one by one.
For example, if we want to extract all the orders which were placed on 2020-07-28 from the ORDERS table, we have to use a cursor as there can be multiple orders in a particular date.
- Related Articles
- What should be used to implement MySQL LIKE statement in MongoDB?
- Which equals operator (== vs ===) should be used in JavaScript?
- If the clothes of a person working in the kitchen catch fire, then to extinguish the fire:A. sand should be thrown over the burning clothesB. water should be thrown over the burning clothes.C. polyester blanket should be used to cover the burning clothesD. woolen blanket should be used to cover the burning clothes
- What is the meaning of “SELECT” statement in MySQL and how can it be used?
- Which equals operator (== vs ===) should be used in JavaScript comparisons
- Which MySQL Datatype should be used for storing BloodType?
- Which function should be used to load a package in R, require or library?
- Which Measurement Unit should be used in CSS to set letter spacing
- MySQL isn’t inserting binary data properly? Which datatype should be used?
- Among id, name, xpath and css, which locator should be used?
- Explain the use of SELECT DISTINCT statement in MySQL using Python?
- Explain various techniques used in financial statement analysis.
- How MySQL IF statement can be used in a stored procedure?
- How Can MySQL LOOP statement be used in a stored procedure?
- MySQL case statement inside a select statement?

Advertisements