select decode(substr(id,1,1),1,'a',2,'a','') a,decode(substr(id,1,2),33,'bb',44,'bb','') b,decode(subtr(id,1,3),555,'ccc',666,'ccc','') c form table;

解决方案 »

  1.   

    select decode(substr(id,1,1),'1','a','2','a','') || decode(substr(id,1,2),'33','bb','44','bb','') || decode(subtr(id,1,3),'555','ccc','666','ccc','') form yourtable;
    如果你的id是数值型的话,就用to_char(id)替换id
      

  2.   

    赫赫,楼上的把一个字段变成3个字段拉
    select decode(substr(id,1,1),1,'a',2,'a',
         (decode(substr(id,1,2),33,'bb',44,'bb',
           (decode(subtr(id,1,3),555,'ccc',666,'ccc',''))))
    from tablename;
     
      

  3.   

    呵呵,sorry!!SQL> select decode(substr(555,1,1),1,'a',2,'a',(decode(substr(555,1,2),33,'bb',44,'bb',(decode(subst
    r(555,1,3),555,'ccc',666,'ccc',''))))) from dual;DEC
    ---
    ccc
      

  4.   

    原来substr()可以直接对数值操作啊,又学了一招
      

  5.   

    为什么不自己去查查decode函数的用法?