eg:select length(trim('xx'))  from 表 , xx字段的长度为 20,或者 为空('')
我想过滤条件为 length('xx') = 0 .select * from 表 where length(trim('xx')) < 1 为什么一条数据也查部出来。明明我知道有数据符合条件。求帮助

解决方案 »

  1.   


    --第一,你的xx不要加'',否则会认为为字符串xx,第二length空为null,不为0
    with t(xx) as(
    select ' ' from dual
    union all select 'x ' from dual
    )
    select * from t where length(trim(xx)) is null;
      

  2.   

    select * from 表 where length(trim('xx')) < 1  我想过滤条件为 length('xx') = 0 .为什么一条数据也查部出来。明明我知道有数据符合条件。求帮助因为你的语法有问题.而且是逻辑之间矛盾.第一XX 字段有值的情况是 1  xx='bbbb' xx='空格b空格'  xx=NULL我想过滤条件为 length('xx') = 0 . 那必定是 值=NULL