Which guidelines should be considered when designing and using cursors in a PL/SQL block? ?
(Choose all that apply.)
A.
When fetching from a cursor, fetch into a record.
B.
Use parameters with cursors so that the result set for the cursor is not tied to a specific
variable in a program.
C.
Use the %NOTFOUND attribute in combination with the SELECT INTO statement to check for
non existent values.
D.
Whenever possible, explicitly declare the cursor and use the OPEN, FETCH and CLOSE
statements to manipulate the cursor instead of using cursor FOR loop.
E.
When using data manipulation language statements, (DML) reference a SQL cursor attribute
immediately after the DML statement executes in the same block.
A,B,E
http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/sqloperations.htm
C – invalid:
The %NOTFOUND attribute is not useful in combination with the SELECT INTO statement:
If a SELECT INTO statement fails to return a row, PL/SQL raises the predefined exception NO_DATA_FOUND immediately, interrupting the flow of control before you can check %NOTFOUND.
A SELECT INTO statement that calls a SQL aggregate function always returns a value or a null. After such a statement, the %NOTFOUND attribute is always FALSE, so checking it is unnecessary.
A B E
Doesn’t designing a cursor means explicit cursor and explicit cursor doesn’t raise no_data_found exception.SO we check for non existent values.