Friday, December 14, 2018

What is cursor and types of cursor?

The Oracle engine uses a work area for its internal processing in order to execute an SQL statement. This work area is private to SQL’s operations and is called a cursor.

Implicit Cursor: Implicit cursor is declared by PL/SQL implicitly for all DML statements & for single rows.

Explicit Cursor: Explicit cursors are declared explicitly by the user, the explicit cursor is for queries only and allows multiple rows to be processed from the query Defined in the declare section of the plsql block.
You have made it like this:
Cursor C1 is select ename from emp;

Ref Cursor: Ref Cursor is the object name of the cursor type. It’s mainly used for dynamic purposes.
TYPE ref_type_name IS REF CURSOR [RETURN return_type]
TYPE empcurtype IS REF CURSOR [RETURN emp%type]

No comments:

Post a Comment