Removing duplicate rows from temporary table
SubbuMay 17 2007 — edited May 18 2007Hi All,
I am populating a temporary table in my procedure. I have to remove duplicate rows from the temporary table.
I am using the following SQL
delete from RPT_BU_GTEMP t1
where t1.rowid <
( select max(t2.rowID) from RPT_BU_GTEMP t2
where t1.BU_ID = t2.BU_ID
AND T1.S_BU_ID = T2.S_BU_ID
and t1.HRCHY_ID = t2.HRCHY_ID
AND T1.COMPANY_ID = T2.COMPANY_ID
AND T1.DATA_SRC = T2.DATA_SRC);
Its taking huge time to process this since the temporary table is not key organized.
Please help me in overcoming this issue. Is there any better way to remove duplicates.
Thanks in advance.
Regards,
Subbu S