语句select * from A,V where v.SWGLM = a.SWGLM 报invalid number
A是一个表,SWGLM是number(15)V是一个视图
select E.SWGLM from E  
union all select F.SWGLM from F  
union all select to_char(G.SWGLM) from G
E.SWGLM是varchar2(32)
F.SWGLM是varchar2(32)
G.SWGLM是number(15)我写成
select * from A,V where v.SWGLM = to_char(a.SWGLM)
select * from A,V where to_char(v.SWGLM) = to_char(a.SWGLM)
select * from A,V where to_number(v.SWGLM) = a.SWGLM
都没有用其实整个程序原来是正常的,只是在视图V里添加了union all select to_char(G.SWGLM) from G,就报错了

解决方案 »

  1.   

    数据是不能修改的,我现在就是希望swglm以字符方式比较
      

  2.   

    我测试了你这sql,是可以通过的,你看能不drop掉view,重新弄个新的试试。
      

  3.   

    trim(to_char(G.SWGLM))
    试试……
      

  4.   

    查看下执行计划,看是在哪一步进行了TO_NUMBER运算:
    explain plan for select * from A,V where v.SWGLM = to_char(a.SWGLM);
    select * from table(dbms_xplan.display);
      

  5.   

    select * from A,V where v.SWGLM = a.SWGLM||''