oracle 10g的数据库,有一个upate 的问题:
比如有一字段col的值为asdfghh现在想把字段中的某些字母给删掉,比如说删掉dfg;更新后的值即为ashh;
请问如何用update实现,谢谢!!!

解决方案 »

  1.   

    楼主也不说把答案贴一下。我给出一下吧。UPDATE tablename t SET t.col=REPLACE(col,dfg);
    commit;结果:
    asdfghh--->ashh如果有其他条件可以加个whereeg:UPDATE tablename t SET t.col=REPLACE(col,dfg) where t.col like '%dfg%';
    commit;
      

  2.   

    UPDATE tablename  SET col=REPLACE(col,'dfg','ashh') where col like '%dfg%';
    commit;
      

  3.   

    这样应该不符合LZ的要求吧,应该是REPLACE(col,'dfg','');
      

  4.   

    哦,没注意,应该这样:
    UPDATE tablename  SET col=REPLACE(col,'dfg','') where col like '%dfg%'; 
    commit;
      

  5.   

    UPDATE tablename  SET col='ashh' where col like '%dfg%'; 
    这样是不是更直接