各位大侠,我有一张表,里面的一列为字符串,当我在where条件里面写这一列等于数字1的时候报:ORA-01722 无效数字;但是当写这一列等于0时却不报错,可以查到记录,这张表中这列记录的值为字符串1和0两种值,请问这是怎么回事?

解决方案 »

  1.   

    with t as (
    select 1 id ,'1' name from dual
    union all select 0 ,'0' from dual
    )
    --select * from t where name =1;
    select * from t where name =0;
      

  2.   

    没有楼主说的现象。。create table t(s1 varchar2(2));
    insert into t values ('1');
    insert into t values ('0');
    SQL> select * from t where s1=1;
     
    S1
    --
    1
     
    SQL> select * from t where s1=0
      2  ;
     
    S1
    --
    0
     
    SQL>