-
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
asy_csr;
B. Redefine the cursor as cursor cnt_csr is select NAME from
CONTESTANT for update;
C. update CONTESTANT set COUNTRY = ’USA’ where NAME =
asy_csr.NAME;
D. You cannot achieve this functionality with PL/SQL.
Cheers!
OraKid.
-
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]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|