怎么样判断一个字符串为空啊
if aa is null then 
这样不好用啊.请教高手啊.

解决方案 »

  1.   

    为空和NULL是有区别的
    不能只用一条AA IS NULL 来判断哦
      

  2.   

    1  如果是作为控制条件:
    --aa为变量
    if aa is null then
    ...
    end if;2  如果是sql语句:
    --aa为列名
    select decode(aa,null,'当空时要填充的内容','非空时内容','默认内容') from yourtable3  如果作为sql语句中的条件:
    select ... from tablename where aa is null and ...
    可以综合以上三者处理各种空值比较问题
      

  3.   

    if nvl(aa,'0')=0 then
      dbms_output.putline('字符串为空');
    end if;
      

  4.   

    declare 
    v_aa varchar2(10);
    begin
    v_aa := null;
    v_aa := '';
    if v_aa is null or v_aa = '' then
    dbms_output.put_line('空');
    end if;
    end;
      

  5.   

    case when 表列名 IS NULL
    THEN 表达式
    WHEN 。
    THEN 。
    ELSE 
    ENDNVL(列名,值)--列名为空取参数二
    DECODE()。
      

  6.   

    为空 where is null不为空 where is not null