Hi,

If i do update and delete operations on a row pointed by cursor's current
then only first operation succeeds, second operation fails.
Ex.
DROP TABLE IF EXISTS tab;
create table tab (num int,num2 int );
insert into tab values(1,100);
insert into tab values(2,200);
insert into tab values(3,300);
insert into tab values(4,400);
insert into tab values(5,500);
insert into tab values(6,600);
insert into tab values(7,700);
insert into tab values(8,800);
insert into tab values(9,900);
insert into tab values(10,1000);
BEGIN;
DECLARE c CURSOR FOR SELECT num FROM tab;
FETCH 5 FROM c;
UPDATE tab SET num=500 WHERE CURRENT OF c;
DELETE FROM tab WHERE CURRENT OF c; --> This delete fails.
SELECT * FROM tab;
FETCH 2 FROM c;
COMMIT;
SELECT * FROM tab;
FETCH 2 FROM c;

Is this as expected..??

Thanks,
Dharmendra Goyal

Reply via email to