先对结果集排序然后做update、delete操作


--先排序然后删除第n条数据
delete from scott.emp
 where empno in (select empno
                   from (select *
                           from scott.emp
                          where comm is null
                            and rownum < 2
                          order by hiredate desc));

--先排序然后更新第n条数据
update scott.emp                                  
   set comm = 123                                 
 where empno in (select empno                     
                   from (select empno             
                           from scott.emp         
                          where rownum < 2        
                            and comm is null      
                          order by hiredate asc));


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM