Page 1 of 1

oracle9i,pl/sql

Posted: Wed Jun 20, 2007 9:34 am
by kareem2003
what is diff of between delete and trancate ,
who can apply commit on triggers

Posted: Wed Jun 20, 2007 9:58 pm
by amirtai
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

Posted: Tue Jul 10, 2007 7:41 am
by kareem2003
thinks sir,
if u r know oracle give replay,
i have table like as
23 24 24 24
22 22
33 33
then output comes like
23,24,24,24
22,,,22
33,,33,
but i need as follows
23,24,24,24
22,22
33,33
how sir?