SELECT * FROM TABLE1 WHERE TO_NUMBER(ID) > 0

解决方案 »

  1.   

    不对报错“ORA-01722无效数字:”
    我那id原来的类型是varchar2(50)
      

  2.   

    我是自己谢了一个函数完成这个功能的,
    create or replace function my1 (myparameter in char) return integer is
      straa char(255);
      numbb int;
    begin
      straa:=trim(myparameter);
      numbb:=to_number(straa);
      return numbb;
    excption:
      when others
        return 0;--在遇到“ORA-01722无效数字”时返回0
    end;
      

  3.   

    --把上面网友的函数改了一下.
    create or replace function my1 (myparameter in varchar2) return number is
      numbb int;
    begin
      numbb:=to_number(myparameter);
      return numbb;
    excption:
      when others then
        return 0;--在遇到“ORA-01722无效数字”时返回0
    end;
      

  4.   

    兄弟我很笨,也不熟悉oracle,那么那位帮忙告诉我如何操作,实在是不明白怎么作
      

  5.   

    问一句,你是想判断这字段的类型,还是要判断你取的字段是数字。
    如果你想判断是数字则:
     如:dinya2003(OK)说的! 
    如果要判断类型则:
    select DATA_TYPE from  user_tab_columns where table_name like 'TABLE1' and COLUMN_NAME like 'ID';
      

  6.   

    我是想再取出数据都是数值,但是dinya2003(OK)说的我不会用耶,:-(
      

  7.   

    --- 判断是否全部是数字及点  
       v_string :=rtrim(input,'0123456789.');  
       if v_string is not null then  
          .....
       end if;
      

  8.   

    先在SQL*PLUS中执行我给你的代码(楼下改的也可以),执行完之后你最好执行一个创建同义词的语句,然后在执行一个授权的语句,这样你数据库中所有的用户就都可以使用这个函数了。create public synonym myCheck for user.my1;
    grant execute on myCheck to public;
      

  9.   

    ORACLE指定一个字段的类型后,这个字段的所有内容都是同一类型。
    指定ID为NUMBER时,ID字段的值都是数字型的。
    select data_type from user_tab_columns 
     where table_name='table1' and column_name='id'
    可以看你的ID字段的类型。
      

  10.   

    加进去后报错
    "行号= 6 列号= 9 错误文本= PLS-00103: 出现符号 ":"在需要下列之一时: :=.(@%; "
      

  11.   

    ??? zealot_zk(风中追风) ( )老兄还在吗,我想你一定会帮我的
      

  12.   

    exceptino 后面的“:”去掉试一试