|
-
Hi shenru,
Here are 2 options.
Test them first, I just wrote it without:
declare
cursor c_check
is
select part_no, case_no, count(0) part_cnt
from the_table
group by part_no, case_no
having count(0) > 1
;
begin
for vc_check in c_check
loop
delete from the_table
where part_no = vc_check.part_no
and case_no = vc_check.case_no
and rownum < vc_check.part_cnt
;
end loop;
end;
/
Or without a cursor:
delete from the_table t1
where (part_no, case_no) in
( select part_no, case_no
from the_table t2
where t1.part_no = t2.part_no
and t1.case_no = t2.case_no
and t1.rowid > t2.rowid
)
;
Regards
Ben de Boer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|