Which guidelines should be considered when designing and using cursors in a PL/SQL block? ?

Which guidelines should be considered when designing and using cursors in a PL/SQL block? ?
(Choose all that apply.)

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.



Leave a Reply 5

Your email address will not be published. Required fields are marked *


Rajnish

Rajnish

B. is Incorrect Because %notfound use after each DML statement,and INTO statement bound to no_data_found.

D. is incorrect because in PLSQL block always use For…Loop to manipulate the data where as Explicit cursor use inside the procedure.

Leo Yu

Leo Yu

answeer A) B) E). B) – the cursor result set would not depend on one variable value. E) – check out cursor attribute immediately after calling DML.
Help why A)?: A is correct, but we can have alternative: INTO var1, var2 ,…

jasn

jasn

ABE

For A
Use of ROWTYPE must be encouraged to fetch a record from the cursor result set. It not only reduces the overhead of creating and maintaining multiple local variables but also inherits the structure of the SELECT column list.