oracle11g - use of ROLLBACK command in Oracle -
i created table
sql>create table student ( studid number(6), studname varchar2(25), joindate date ); table created. sql>insert student values (123,'john',sysdate); 1 row created. sql>delete student; 1 row deleted.
how can row ? if use
sql>rollback; rollback complete.
but after that
sql>select * student; no rows selected.
why coming?
rollback
tells oracle roll entire transaction. in case, both insert
, delete
part of same transaction rollback
reverses both operations. returns database state in following create table
statement.
some alternatives:
- if issue
commit
afterinsert
delete
statement in separate transaction ,rollback
reverse effect ofdelete
statement. - you create savepoint after running
insert
statement , rollback savepoint afterdelete
rather rolling entire transaction.
Comments
Post a Comment