Identify the scenario in which you would use the current of clause for an update or delete statement to rows fetched from a cursor.
A.
when you want to lock the rows fetched by the cursor
B.
when you want to update or delete the result set without affecting the rows in the table ‘
C.
when you want the database not to wait if the requested rows are locked by another user
D.
when you want to ensure that the current rows fetched by the cursor are updated or deleted
I doubt this answer: In my opinion it is used to return the changes to the table.
Test code:
declare
cursor c is select * from emp_temp for update;
r emp_temp%rowtype;
i number(2) := 0;
begin
open c ;
dbms_output.put_line(‘Start’);
loop
i := i + 1;
fetch c into r;
exit when c%notfound;
dbms_output.put_line(‘ename: ‘||r.ename || ‘ empno: ‘ || to_char(r.empno));
update emp_temp set deptno = i where current of c;
end loop;
dbms_output.put_line(‘Finished’);
close c;
end;
select * from emp_temp; –Here you see the changes.
rollback;
Checking from the same connection I saw the changes IN THE TABLE.
What did I misunderstand?
hm… probably wanted to say:
update or delete the result set __(THE ROWS FROM RESULT SET)__ without affecting __OTHERS__ rows in the table.
“current of” simply simulating “ROWID”
Well, might be!
Up to now I was used to exam questions translated from English to German. With sometimes misleading results.
I guess THIS exam question got translated from Hindi to English :->
Thanx for your explanation: Makes sense!
Best regards 🙂
The Where Current Of statement allows you to update or delete the record that was last fetched by the cursor.
B is the correct answer? confirmation required
correct answer is D
for example, when you want to base an update on the existing values in a row. You must make sure the row is not changed by another user before your update.
http://docs.oracle.com/cd/A57673_01/DOC/api/doc/PC_22/ch08.htm#fupdate
correct answer is D
correct answer is D
‘Ensure’ is meant for “for update” clause
where Current of clause is used to update or delete the row fetched by the cursor.
Here resultset means rows fetched by the cursor.
http://www.techonthenet.com/oracle/cursors/current_of.php
Ans: B
“Where current of” is for update or delete table, not for resulset.
Correct answer is D
You are right about “ensure” means for update, but question is bout CURRENT OF clause not about FOR UPDATE
Correct answer IS B, explanation is the same (made a typo)
D
without affect row in the table ?
it’s terrible.
You a right D
D is Correct Answer..
D
D
D
Ans D
The WHERE CURRENT OF Clause
Syntax:
• Use cursors to update or delete the current row.
Ans D
http://www.techonthenet.com/oracle/cursors/current_of.php
It is used to update/Delete only current RECORD and not RESULTSET of cursor…so and is D
D
D
D is correct
This Question is very confusing but lets try one option at a time.
A – No, Current of does not lock for rows.
B – No, Without effecting the rows in the table defeats the purpose of Current of.
C – No, like A it does not have anything to do with locking.
D – Yes, Because all other are incorrect and rows fetched by are updated or deleted.
d