what is diff of between delete and trancate ,
who can apply commit on triggers
oracle9i,pl/sql
-
- Posts: 40
- Joined: Tue Jun 12, 2007 11:25 am
- Location: India
- Contact:
Hi
DELETE is like removing bricks one by one from a structure. If any wrong brick is removed you can put it back in the structure. Rows are deleted 1 by 1 from table and stored in rollback segment for read consistancy. There are some overheads involved since if you decide to undo you can get them back from flashback righaway or rollback later before commit.
However the truncate is like you demolish the structure completely. The techqniue simply removes the segment from the used list and put it back in free list. No undo is generated so less overhead.
NOTE: Even dropped table/object can be brought back (as of 10g) but never use truncate unless you are not sure about contents might be needed later. Keeping a backup before truncate is good practice.
COMMIT is a restrictive sub program, so not allowed to be interacting with all triggers though. However triggers like WHEN/KEY at Item level are able to commit changes better you check with version specific list of available triggers that can use commit.
On the other hand DATABASE TRIGGERS can be used to commit data in any table within database. Often used for keep track of changes (audit trial).
Thanks
Amir
DELETE is like removing bricks one by one from a structure. If any wrong brick is removed you can put it back in the structure. Rows are deleted 1 by 1 from table and stored in rollback segment for read consistancy. There are some overheads involved since if you decide to undo you can get them back from flashback righaway or rollback later before commit.
However the truncate is like you demolish the structure completely. The techqniue simply removes the segment from the used list and put it back in free list. No undo is generated so less overhead.
NOTE: Even dropped table/object can be brought back (as of 10g) but never use truncate unless you are not sure about contents might be needed later. Keeping a backup before truncate is good practice.
COMMIT is a restrictive sub program, so not allowed to be interacting with all triggers though. However triggers like WHEN/KEY at Item level are able to commit changes better you check with version specific list of available triggers that can use commit.
On the other hand DATABASE TRIGGERS can be used to commit data in any table within database. Often used for keep track of changes (audit trial).
Thanks
Amir
-
- Posts: 40
- Joined: Tue Jun 12, 2007 11:25 am
- Location: India
- Contact:
Who is online
Users browsing this forum: No registered users and 1 guest