Hello,
I have one concern , I have one table that contains huge data. I have created one procedure inside that procedure I am truncating that table . It takes very long time to execute that. When I saw the Dbms_profiler report I have observed that truncate statement took long time to execute around 20 minutes . Then I replace the truncate with delete . It executed within fraction of time with proper result. May I know why it happened . We all know that for better performance truncate works faster than delete.
I have one concern , I have one table that contains huge data. I have created one procedure inside that procedure I am truncating that table . It takes very long time to execute that. When I saw the Dbms_profiler report I have observed that truncate statement took long time to execute around 20 minutes . Then I replace the truncate with delete . It executed within fraction of time with proper result. May I know why it happened . We all know that for better performance truncate works faster than delete.
Code:
Declare v_state varchar2 (200); Begin Selec…..; Select …..; V_sate:= 'TRUNCATE TABLE XYZ; EXECUTE IMMEDIATE v_sate; END: /
Code:
Declare v_state varchar2 (200); Begin Selec…..; Select …..; Delete table xyz; Commit; END:
Comment