17,377
社区成员
发帖
与我相关
我的任务
分享
--不用过程试一下
update mytable a
set ksbh =
(select rn
from (select rwd,
to_char(kssj, 'yyyymmdd') ||
lpad(to_char(rownum), 2, '0') rn
from (select rowid rwd, t.*
from mytable t
where to_char(kssj, 'yyyy-mm-dd') = '2010-02-03'
order by kssj)) b
where b.rwd = a.rowid)
where to_char(kssj, 'yyyy-mm-dd') = '2010-02-03'
create or replace procedure p_mytable_update
is
begin
for i in 0..99 loop
update mytable
set ksbh=(
select '20100203'||lpad(i, 2, 0)
from dual
)
where to_char(kssj,'yyyy-mm-dd')='2010-02-03' order by kssj asc;
end loop;
commit;
end;
create or replace procedure p_mytable_update
is
begin
for i in 0..99 loop
update mytable
set ksbh=(
select '20100203'||lpad(i, 2, 0)
from dual
)
where to_char(kssj,'yyyy-mm-dd')='2010-02-03' order by kssj asc;
end loop;
end;