Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Removing duplicate rows from temporary table

SubbuMay 17 2007 — edited May 18 2007
Hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 15 2007
Added on May 17 2007
4 comments
827 views