Databases such as ORACLE have a memory area, where processing of instructions and fetched data takes place.A cursor is a pointer which is pointing to this area.The data contained in this memory area is also known as Active Set. Cursors can be broadly classified into Implict Cursors and Explicit Cursors.
Difference between Implicit and Explicit Cursors :
|Implicit Cursors||Explicit Cursors|
|Implicit cursors are automatically created when select statements are executed.||Explicit cursors needs to be defined explicitly by the user by providing a name.|
|They are capable of fetching a single row at a time.||Explicit cursors can fetch multiple rows.|
|They are more vulnerable to errors such as Data errors, etc.||They are less vulnerable to errors(Data errors etc.)|
|Provides less programmatic control to the users||User/Programmer has the entire control.|
|Implicit cursors are less efficient.||Comparitive to Implicit cursors, explicit cursors are more efficient.|
|Implicit Cursors are defined as:
BEGIN SELECT attr_name from table_name where CONDITION; END
|Explicit cursors are defined as:
DECLARE CURSOR cur_name IS SELECT attr_name from table_name where CONDITION; BEGIN ...
|Implicit cursors requires anonymous buffer memory for storage purpose.||Explicit cursors use user-defined memory space for storage purpose|
|Cursor attributes use prefix “SQL”.
Structure for implicit cursors: SQL%attr_name
Few implicit cursors attributes are: SQL%FOUND, SQL%NOTFOUND, SQL%ROWCOUNT
|Structure for explicit cursors: cur_name%attr_name
Few explicit cursors are: cur_name%FOUND, cur_name%NOTFOUND, cur_name%ROWCOUNT
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Difference between Stop and Wait protocol and Sliding Window protocol
- Similarities and Difference between Java and C++
- Difference between Yaacomo and and XAP
- Difference between VoIP and and POTS
- Difference and Similarities between PHP and C
- Difference between Time Tracking and Time and Attendance Software
- Difference Between Single and Double Quotes in Shell Script and Linux
- Difference between ++*p, *p++ and *++p
- Difference Between DOS and Windows
- Difference between User Level thread and Kernel Level thread
- What’s difference between The Internet and The Web ?
- Difference between Priority Inversion and Priority Inheritance
- What’s difference between Linux and Android ?
- What’s difference between header files "stdio.h" and "stdlib.h" ?
- Difference between HTML and HTTP
- Difference between http:// and https://
- What's difference between MMU and MPU?
- What's difference between Microcontroller (µC) and Microprocessor (µP)?
- What's the difference between Scripting and Programming Languages?
- What’s difference between “array” and “&array” for “int array” ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.