日期:2014-05-17 浏览次数:20998 次
--举例如下
SQL> delete emp
2 where not exists (select 1 from
3 (select rownum rn,empno from emp) t
4 where t.empno=emp.empno and t.rn in(2,5));
已删除12行。
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE
---------- -------------------- ------------------ ---------- --------------
SAL COMM DEPTNO
---------- ---------- ----------
7499 Allen SALESMAN 7698 20-2月 -81
1600 300 30
7654 Martin SALESMAN 7698 28-9月 -81
1250 1400 30
SQL> rollback;
回退已完成。
------解决方案--------------------
delete emp
where not exists (select 1 from
(select rownum rn,empno from emp) t
where t.empno=emp.empno and t.rn in(2,5));