Search This Blog

Total Pageviews

Sunday, 3 July 2011

Oracle select can generate undo

Oracle select generates undo in "for update"



SQL> select used_ublk from v$transaction;

no rows selected

SQL> create table anuj as select * from dba_objects;

Table created.

SQL> select used_ublk from v$transaction;

no rows selected

SQL> set timing on
SQL> begin
for i in ( select * from anuj for update )

loop

null;

end loop;

end;
/

PL/SQL procedure successfully completed.

Elapsed: 00:00:03.98
SQL> select used_ublk from v$transaction;

USED_UBLK
----------
840

Elapsed: 00:00:00.03


because of "for update" clause, Oracle modify data block to place lock info . any block change generate undo .

No comments:

Oracle DBA

anuj blog Archive