select decode(substr(colyear,1,1),'1','一','2','二',3...)||substr(colyear,1) from tbname;

解决方案 »

  1.   

    至于这么麻烦么
    replace('1年','一年')不就搞定了?、
    如果是只修改显示的部分,translate函数也行
      

  2.   

    sorry,是replace(字符串,'1年','一年')
      

  3.   

    Example
    This example decodes the value warehouse_id. If warehouse_id is 1, the function returns 'Southlake'; if warehouse_id is 2, it returns 'San Francisco'; etc. If warehouse_id is not 1, 2, 3, or 4, the function returns 'Non-domestic'. SELECT product_id,
           DECODE (warehouse_id, 1, 'Southlake', 
                                 2, 'San Francisco', 
                                 3, 'New Jersey', 
                                 4, 'Seattle',
                                    'Non-domestic') 
           quantity_on_hand FROM inventories;
      

  4.   

    不对写错了.
    是TO   ern(学习Oracle)  
    有很多的不同的数据呀.
      

  5.   

    decode的用法:
    select decode(a.name,'AA','1','BB','2',....,'0') from tablename a where .....
    从表tablename中选择name字段,如果有'AA'就用1代替,如果有'BB',就用2代替.....如果前面的都没有,就用0代替.
      

  6.   

    如果表中有'10年','39年' 
    或者更多不同的数据,我都要写在DECODE的内呀.
    有没有更通用的方法.