PL/SQL tutorial | Cursor in Oracle Database 11g Complete guide

Learn in depth about cursor in oracle database 11g, and why to use cursor.Writing Implicit cursor and explicit cursor following using ‘for loop’ inside cursor to fetch multiple records from oracle database.

Cursor in Oracle
Cursor in PL/SQL
Oracle Cursor
PL/SQL Cursor
What is cursor in PL/SQL
How to use cursor in PL/SQL
Implicit cursor in PL/SQL
Explicit cursor in PL/SQL

A cursor is a pointer to this context area. PL/SQL controls the context area through a cursor. A cursor holds the rows (one or more) returned by a SQL statement. The set of rows the cursor holds is referred to as the active set.

Implicit Cursors
Implicit cursors are automatically created by Oracle whenever an SQL statement is executed, when there is no explicit cursor for the statement. Programmers cannot control the implicit cursors and the information in it.

%FOUND
Returns TRUE if an INSERT, UPDATE, or DELETE statement affected one or more rows or a SELECT INTO statement returned one or more rows. Otherwise, it returns FALSE.

%NOTFOUND
The logical opposite of %FOUND. It returns TRUE if an INSERT, UPDATE, or DELETE statement affected no rows, or a SELECT INTO statement returned no rows. Otherwise, it returns FALSE.

%ISOPEN
Always returns FALSE for implicit cursors, because Oracle closes the SQL cursor automatically after executing its associated SQL statement.

%ROWCOUNT
Returns the number of rows affected by an INSERT, UPDATE, or DELETE statement, or returned by a SELECT INTO statement.

Explicit Cursors
Explicit cursors are programmer-defined cursors for gaining more control over the context area. An explicit cursor should be defined in the declaration section of the PL/SQL Block. It is created on a SELECT Statement which returns more than one row

Linkedin: https://www.linkedin.com/in/aditya-kumar-roy-b3673368/
Facebook: https://www.facebook.com/SpecializeAutomation/

Comments

Dar Zeeshan says:

what is difference between implicit and explicit cursor?

Dar Zeeshan says:

thanks a lot ..nice ….sir can u please tell me why select statement is not used in implicit cursor???

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!