SQL文如下:
select distinct b.dev_nm  from (select dev_id, dev_nm from dmi_device  where upkbn<>'D' 
 and nvl2(translate(dmi_device.dev_id, '+1234567890', '+'), 'is characters', 'is number') ='is number' ) b  
 where to_number('424')=to_number(b.dev_id)请各位大虾找下错误,并给出解决办法,小弟很着急,多谢!!!
解决了马上给分!

解决方案 »

  1.   

    执行后提示:ORA-01722错误。本意是想从dmi_device表中找出所有与'422'匹配所有数字型的记录。
    这些记录的dev_id可以是'0422','00422'等。
      

  2.   

    select * from dmi_device where dev_id like '%422%'
      

  3.   

    无效数字,检查你的to_number(b.dev_id)
      

  4.   

    select distinct b.dev_nm
    from   (select dev_id, dev_nm
            from   dmi_device
            where  upkbn <> 'D' and
                   translate(dmi_device.dev_id, '+1234567890', '+') is null) b
    where  b.dev_id = '424'
      

  5.   

    select distinct b.dev_nm  
    from  dmi_device  
    where dev_id  LIKE '%422%'
     and upkbn<>'D'
      

  6.   

    不用那么麻烦吧,试试这样:select distinct dev_nm from dmi_device
    where  upkbn <> 'D' 
    and ltrim(dev_id,'0') = '424'