Saturday 28 March 2015

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 statement & for single row.

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

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

No comments:

Post a Comment