数据库中记录存储为AA,BB,CC
想查询出的结果为'AA','BB','CC'求教一下这个函数要怎么写,多谢了。

解决方案 »

  1.   

    try it ..
    SQL> select replace(t1,'AA,BB,CC',chr(39)||'AA'||chr(39)||','||chr(39)||'BB'||chr(39)||','||chr(39)||'CC'||chr(39))
      2    from (
      3          select 'AA,BB,CC' as t1 from dual
      4          union all
      5          select 'AA,BB,ZCC' as t1 from dual
      6         ) tt
      7   where instr(t1,'AA,BB,CC') > 0;REPLACE(T1,'AA,BB,CC',CHR(39)|
    --------------------------------------------------------------------------------
    'AA','BB','CC'
      

  2.   

    select ''''||replace('AA,BB,CC',',',''''||','||'''')||'''' from dual;