If you have an open cursor on a table, modify the same tableand commit, what would happen?

Showing Answers 1 - 8 of 8 Answers

sangeeta

  • Jun 1st, 2005
 

changes will be committed

  Was this answer useful?  Yes

basavaraj kolur

  • Aug 26th, 2006
 

hi friend ,

      once you open cursor,ths select related to cursor is get excuted ,and active set is formed that is rows select from the table.once active set formed on table,after that  you have done any dml operation on table nothin will happen to cursor rows.because it takes zerox copy from the table ......

  Was this answer useful?  Yes

kishore_m_k

  • Apr 19th, 2007
 

it updates the table without any problem.

CREATE TABLE dept1 AS SELECT * FROM dept;

declare
  r1 dept1%rowtype;
  cursor c1 is select * from dept1 for update of deptno;
begin
  open c1;
  loop
     fetch c1 into r1;
     exit when c1%notfound;
     update dept1 set deptno=deptno+1 where current of c1;
  end loop;
  close c1;
end;

  Was this answer useful?  Yes

AK

  • Jul 3rd, 2007
 

Depends on when you commit the changes. If u are processing like above (in a for loop) you should commit post processing, after the cursor is closed. But that's often not useful on huge amount of data.

any commited transactions to cursor data while the cursor is still active will lead to "ORA-1555 snapshot too old" error.

Cheers,
AK

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions