The cursor is a private work area for an SQL statement, when the SQL statement is executed in PL/SQL block, the Oracle engine assigns a private work area for that statement. The cursor stores the statement and result after execution.
There are two types of Cursor implicit cursor and explicit cursor.
Example of Implicit Cursor
DECLARE
var datatype
BEGIN
select * from table; // Your SQL statement
END;
Example of Explicit Cursor
DECLARE
CURSOR cursor_name is
select * from table; // Your SQL statement
BEGIN
OPEN cursor_name;
FETCH cursor_name // Your SQL statement
CLOSE cursor_name;
END;
No comments:
Post a Comment