【正文】
內(nèi)容反插回來(lái))(4).適用于有大量重復(fù)記錄的情況(exception into 子句法):采用alter table 命令中的 exception into 子句也能確定出庫(kù)表中重復(fù)的記錄。ORACLE中刪除重復(fù)記錄平時(shí)工作中可能會(huì)遇見當(dāng)試圖對(duì)庫(kù)表中的某一列或幾列創(chuàng)建唯一索引時(shí),系統(tǒng)提示 ora01452 :不能創(chuàng)建唯一索引,發(fā)現(xiàn)重復(fù)記錄。 (清空cz表的數(shù)據(jù),但保留cz表的結(jié)構(gòu))sqlinsert into cz select * from test。 c1 c10 c20 1 2 dsf 2 3 che 3 4 dff 4 5 err 5 3 dar 6 1 wee 7 2 zxc7 rows selected.從結(jié)果里能看到重復(fù)記錄已刪除。sqldelete from cz a where (select max(rowid) from cz b where = and = and =)。經(jīng)查看表cz總共有16條記錄:sqlset pagesize 100sqlselect * from cz。具體步驟如下:sql?/rdbms/admin/table created.sqldesc exceptions name null? type row_id rowid owner varchar2(30) table_name varchar2(30) constraint varchar2(30)sqlalter