如下表:month    jfje
1           2
1           5
1           6
1           7
2           0
2           5
2           0
2           0
2           0
2           6我想把month=2的数据中,字段jfje为0的值,全部改为空‘null’
改后如下表,求教,谢谢,month    jfje
1           2
1           5
1           6
1           7
2           
2           5
2           
2           
2           
2           6

解决方案 »

  1.   

    select MONTH,case when month = 2 and jfje = 0 then null else jfje end JFJE from test 
      

  2.   


    update A
    set jfje=null where month=2 
      

  3.   

    直接用update就行了啊。
    update 表名 set jfje=null where month='2';
    这样就行了啊。
      

  4.   

    2楼,3楼的兄弟,这样会不会把2月的数据,全部置为‘null’呀,我只是要jfje=0是才改为null的?
      

  5.   

    update tablename set jfje=null where month=2 and jfje=0
      

  6.   


    update test set jfje=replace(jfje,'0','') where month='2'
      

  7.   

    再加个条件就行了update A
    set jfje=null where month=2 and jfje=0
      

  8.   

    用可更新游标
    declare
    cursor c is
    select * from tt for update;
    begin
    for v_temp in c loop
    if(v_temp.month=2 and v_temp.jfje=0) then
    update tt set b=null where current of c;
    end if;
    end loop;
    commit;
    end;
    把表名改一下,我不知道你的表叫什么就随便取个tt