Which two statements are true about the usage of the cursor for loops? (Choose two.)
A.
The cursor needs to be closed after the iteration is complete.
B.
The implicit open, fetch, exit, and close of the cursor happen.
C.
The record type must be explicitly declared to control the loop.
D.
The PL/SQL creates a record variable with the fields corresponding to the columns of the cursor result set.
B and D
Can anyone please explain
Can anyone please explain D?
You don’t need to create record explicitly. Oracle will create it implicitly.
Example:
Begin
For dual_record in (select * from dual) Loop
dbms_output.put_line(’11’);
end Loop;
end;
it works, but dual_record wasn’t declared by programmer, it was done by Oracle implicitly.
Also open, fetch, exit, and close of the cursor were done implicitly
Compare explicit cursor usage:
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/static.htm#LNPLS006
and For loop cursor:
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/cursor_for_loop_statement.htm#LNPLS1155
B,D
Always a major fan of linking to bloggers that I really like but do not get lots of link love from.