Oracle Tutorials

Google

Explicit cursor is a cursor in which the cursor name is explicitly assigned to a SELECT statement via the CURSOR...IS statement. An implicit cursor is used for all SQL statements
Declare, Open, Fetch, Close. An explicit cursors are used to process multirow SELECT statements
An implicit cursor is used to process INSERT, UPDATE, DELETE and single row SELECT.
.INTO statements.

What are cursor attributes ?
%ROWCOUNT, %NOTFOUND, %FOUND, %ISOPEN

What is a cursor for loop ?
Cursor For Loop is a loop where oracle implicitly declares a loop variable, the loop index that of the same record type as the cursor's record.

Difference between NO DATA FOUND and %NOTFOUND ?
NO DATA FOUND is an exception raised only for the SELECT....INTO statements when the
where clause of the querydoes not match any rows. When the where clause of the explicit
cursor does not match any rows the %NOTFOUND attribute is set to TRUE instead.

What a SELECT FOR UPDATE cursor represent ?
SELECT......FROM......FOR......UPDATE[OF column-reference][NOWAIT] The processing done in a fetch loop modifies the rows that have been retrieved by the cursor. A convenient way of modifying the rows is done by a method with two parts: the FOR UPDATE clause in the cursor declaration, WHERE CURRENT OF CLAUSE in an UPDATE or
declaration statement.

What 'WHERE CURRENT OF ' clause does in a cursor ?
LOOP SELECT num_credits INTO v_numcredits FROM classes WHERE dept=123 and
course=101;
UPDATE students SET current_credits=current_credits+v_numcredits WHERE CURRENT OF
X;
END LOOP
COMMIT;
END;

What is use of a cursor variable? How it is defined ?
A cursor variable is associated with different statements at run time, which can hold different values at run time. Static cursors can only be associated with one run time query. A
cursor variable is reference type(like a pointer in C).
Declaring a cursor variable:
TYPE type_name IS REF CURSOR RETURN return_type type_name is the name of
the reference type,return_type is a record type indicating the types of the select list
that will eventually be returned by the cursor variable.

What should be the return type for a cursor variable. Can we use a scalar data type as
return type ?
The return type for a cursor must be a record type.It can be declared explicitly as a user-defined or
%ROWTYPE can be used. eg TYPE t_studentsref IS REF
CURSOR RETURN students%ROWTYPE
How you open and close a cursor variable.Why it is required ?