【正文】
16 rows deleted.sqlinsert into cz select distinct * from dups。這種方法稍微麻煩一些,為了使用“excepeion into ”子句,必須首先創(chuàng)建 exceptions 表。sqldelete cz where rowid not in(select min(rowid) from cz group by c1,c10,c20)。 下面總結(jié)一下幾種查找和刪除重復(fù)記錄的方法(以表cz為例):表cz的結(jié)構(gòu)如下:sql desc cz name null? type c1 number(10) c10 number(5) c20 varchar2(3)刪除重復(fù)記錄的方法原理: (1).在oracle中,每一條記錄都有一個rowid,rowid在整個數(shù)據(jù)庫中是唯一的,rowid確定了每條記錄是在oracle中的哪一個數(shù)據(jù)文件、塊、行上。 c1 c10 c20 1 2 dsf 2 3 che 3 4 dff(2).sqlselect distinct * from cz。 (建一個臨時表test用來存放重復(fù)的記錄)sqltruncate table cz。 table created.sqlselect * from dups。:數(shù)據(jù)庫中有deny_mobile表需要按照 mobile去重復(fù),刪除重復(fù)記錄為:Delete from SMS_DENYMOBILE WHERE mobile IN (SELECT mobile FROM SMS_DENYMOBILE GROUP BY mobile HAVING COUNT(*)1)AND RO