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是可以执行才对,为什么一到存储过程就不行?? 我怀疑是配置问题
上面写错了。。sorry,应该是select a2 into v_a2 from A where a1=2 不行 select a2 into v_a2 from A where a1=1 行的
我试过啦。declare hello varchar2(10); begin select a2 into hello from test1 where a1=2; DBMS_OUTPUT.PUT_LINE ('Test Result:'||hello); end; /没有什么问题啊。
为什么将NULL值进行赋值啊,加个条件,把符合该条件的记录直接置为NULL不就得了---
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;
http://211.99.196.144:8090/forum1/frontshow/dispbbs.jsp?boardid=107&id=4733
表Aa1 a2
------------------
1 aaa
2 NULL
select a2 into v_a2 from A where a1=1
上面的语句放到存储过程中,一执行就退出
但select a2 from A where a1=1是可以执行才对,为什么一到存储过程就不行??
我怀疑是配置问题
select a2 into v_a2 from A where a1=1 行的
begin
select a2 into hello from test1 where a1=2;
DBMS_OUTPUT.PUT_LINE ('Test Result:'||hello);
end;
/没有什么问题啊。
相反 ... where a1=2不存在记录就出错,可以修改为以下:
select nvl(max(a2),null) into v_a2 from A where a1=2;
beckhambobo(beckham) 说的有一定道理不过也许数据库配置问题。。看来得慢慢解决了。。今晚结贴