我现在只能用select count(*)的办法判断一个记录是否存在,用NVL来暂时敷衍过去但很多地方还是得用NULL才行的。。是不是要给数据库设置某个参数值?

解决方案 »

  1.   

    SQL语句查询不出列值为NULL的字段这是正确的啊,
      

  2.   

    NULL值的使用有点特殊,可能泥对NULL值理解的不大清楚,null值的使用和说明,详见帖子:
    http://211.99.196.144:8090/forum1/frontshow/dispbbs.jsp?boardid=107&id=4733
      

  3.   

    shuipipi(水皮皮) :^_^,你好,又见面了to nicholaz(九思·逢尤) 你说的“SQL语句查询不出列值为NULL的字段”,也许你把我意思理解错。我是指
    表Aa1             a2
    ------------------
    1              aaa
    2              NULL
    select a2 into v_a2 from A where a1=1
    上面的语句放到存储过程中,一执行就退出
    但select a2  from A where a1=1是可以执行才对,为什么一到存储过程就不行??
    我怀疑是配置问题
      

  4.   

    上面写错了。。sorry,应该是select a2 into v_a2 from A where a1=2  不行
    select a2 into v_a2 from A where a1=1  行的
      

  5.   

    我试过啦。declare hello varchar2(10);
    begin
    select a2 into hello from test1 where a1=2;
    DBMS_OUTPUT.PUT_LINE ('Test Result:'||hello);
    end;
    /没有什么问题啊。
      

  6.   

    为什么将NULL值进行赋值啊,加个条件,把符合该条件的记录直接置为NULL不就得了---
      

  7.   

    select a2 into v_a2 from A where a1=2;  --只有存在记录,不管a2是否为null都成功的.
    相反 ... where a1=2不存在记录就出错,可以修改为以下:
    select nvl(max(a2),null) into v_a2 from A where a1=2;
      

  8.   

    脚本没问题的
    beckhambobo(beckham) 说的有一定道理不过也许数据库配置问题。。看来得慢慢解决了。。今晚结贴