geme the correct answer:
You develop a PL/SQL block that will be used in an overall application
that records grants for political asylum for Olympic athletes to the country
where the games are held. The cursor definition in this block is cursors
asy_csr is select NAME from CONTESTANT. As you loop through the
cursor, you want the ability to update the record back in the table that
corresponds to the record in the cursor. Which of the following choices
best identifies the way to do so without explicit comparison between the
NAME value in the cursor and the NAME value in the table?
A. update CONTESTANT set COUNTRY = ’USA’ where current of
B. Redefine the cursor as cursor cnt_csr is select NAME from
CONTESTANT for update;
C. update CONTESTANT set COUNTRY = ’USA’ where NAME =
D. You cannot achieve this functionality with PL/SQL.
Answer A works - that is what the "where current of" clause is for (can be used for updates and deletes inside a cursor to make changes to last fetched row).
B: Select for update locks the rows in question. Normally, select does not lock rows.
C: where NAME = cursor.NAME is ambiguous
D: eliminated by choosing A
[Edited by stecal on 05-24-2002 at 02:04 PM]
Click Here to Expand Forum to Full Width