Identify the scenario in which you would use the current of clause for an update or delete statement to rows fetched from a cursor.

Identify the scenario in which you would use the current of clause for an update or delete statement to rows fetched from a cursor.

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



Leave a Reply 26

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


sictacuisses

sictacuisses

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?

OldBoyOdeSu

OldBoyOdeSu

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”

sictacuisses

sictacuisses

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 🙂

vins

vins

The Where Current Of statement allows you to update or delete the record that was last fetched by the cursor.

vin

vin

B is the correct answer? confirmation required

mohammed

mohammed

correct answer is D

sp

sp

correct answer is D

DV

DV

‘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

Arturo

Arturo

“Where current of” is for update or delete table, not for resulset.

Uladzimir

Uladzimir

Correct answer is D

You are right about “ensure” means for update, but question is bout CURRENT OF clause not about FOR UPDATE

Uladzimir

Uladzimir

Correct answer IS B, explanation is the same (made a typo)

piero

piero

D
without affect row in the table ?
it’s terrible.

Uladzimir

Uladzimir

You a right D

shivom

shivom

D is Correct Answer..

Jyoti

Jyoti

Ans D

The WHERE CURRENT OF Clause
Syntax:
• Use cursors to update or delete the current row.

Naj

Naj

It is used to update/Delete only current RECORD and not RESULTSET of cursor…so and is D

Ahmed

Ahmed

D is correct

Ammar

Ammar

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.