你的表中有主键吗?
说句你不高兴的话,在实际中几乎没有这种需求。
还是写一下吧:
update your_table set c3='aa',c4='bb' where c1=1;
update your_table set c3='cc',c4='dd' where c1=3;
update your_table set c3='ee',c4='ff' where c1=5;
update your_table set c3='',c4='' where c1=7;
commit;
update your_table set c3='',c4='' where c1 is null;
commit;

解决方案 »

  1.   

    主键是自动加1的:
    primary_column c c1 c2 c3 c4
    ---------------------------------------------------------
    1 01 1 2
    2 01 3 4
    3 01 5 6
    4 01 7 8
    5 01 aa bb
    6 01 cc dd
    7 01 ee ff
      

  2.   

    update table_name set c3=aa,c4=bb where c1=1 and c2=2;
    update table_name set c3=cc,c4=dd where c1=3 and c4=4;
    update table_name set c3=dd,c4=ee where c1=5 and c5=6;
    写了不止一个了  :)
      

  3.   

    主键是自动加1的:
    primary_column c c1 c2 c3 c4
    ---------------------------------------------------------
    1 01 1 2
    2 01 3 4
    3 01 5 6
    4 01 7 8
    5 01 aa bb
    6 01 cc dd
    7 01 ee ff
      

  4.   

    若c1与c3,c2与c4有规律,可以这样update a set c3=chr(64+c1)||chr(64+c1),c4=chr(64+c2)||chr(64+c2) where chr(64+c2)<=(select max(substr(c4,1,1)) from b)
      

  5.   

    下面假设你表中的c都是01,如果c也会不同的话,则需增加一重嵌套查询,也可以在匿名块中用一个cursor针对不同的c循环执行下面的update语句update yourtable d set (c3,c4) = 
    ( select e.c3,e.c4 from 
     ( select a.primary_column,a.c1,a.c2,b.c3,b.c4
      from ( select rownum no,primary_column,c,c1,c2 from yourtable where c3 is null and c4 is null) a,
           ( select rownum no,c1,c2 from yourtable where c1 is null and c2 is null) b
      where a.no=b.no(+)
     ) e
     where d.primary_column = e.primary_column 
    )
    where d.c1 is not null and d.c2 is not null and d.c3 is null and d.c4 is null
      

  6.   

    BlueskyWide(谈趣者) 说得对现行的数据库都是“关系”型的,没有规律的东西就
    不要用到数据库中算了。看来你只能一条条update了