日期:2014-05-17  浏览次数:20961 次

将oracle数据库前10条数据的日期字段update,在线等
将oracle数据库前10条数据的日期字段update,怎么写sql语句

------解决方案--------------------
update *** set riqi=' ' where rownum<=10;
但是你得按什么顺序吧
------解决方案--------------------
SQL code
update tb set date=' ' where id in 
(select id from (select id,rownum rn from tb order by date) where rn<=10)

------解决方案--------------------
测试数据:
SQL code

CREATE TABLE T149
(
    ID NUMBER(2),
    MyDaate DATE
);
DELETE T149;
INSERT INTO T149 VALUES(11, TO_date('2012-03-10', 'YYYY-MM-DD'));
INSERT INTO T149 VALUES(22, TO_date('2012-03-01', 'YYYY-MM-DD'));
INSERT INTO T149 VALUES(33, TO_date('2012-03-12', 'YYYY-MM-DD'));
INSERT INTO T149 VALUES(44, TO_date('2012-03-15', 'YYYY-MM-DD'));
INSERT INTO T149 VALUES(55, TO_date('2012-03-04', 'YYYY-MM-DD'));
INSERT INTO T149 VALUES(66, TO_date('2012-03-20', 'YYYY-MM-DD'));

------解决方案--------------------
SQL code

update A
set A.date = xxx
where exists (select 1 from A where rownum < 11)