Compilation errors for PROCEDURE TESTLDJ3Error: PLS-00103: 出现符号 "CASE"在需要下列之一时: (-+modnull<an identifier> <a double-quoted delimited-identifier><a bind variable>table avgcountcurrentmaxminpriorsqlstddevsumvarianceexecutethe foralltimetimestampintervaldate <a string literal with character set specification> <a number><a single-quoted SQL string> Line: 7 Text: case when stage = '检验' then sum(qty) end xpjy, 我试过,不可以的。
应该这样用 sum(case when stage = '检验' then qty else 0 end) xpjy,
我的写法 case when stage = '检验' then sum(qty) end xpjy, 和你的写法 sum(case when stage = '检验' then qty else 0 end) xpjy, 单独作为sql语句执行都是可以的。 但是放在存储过程里面就不可以了。
你说不行我也没有办法,select sum(case when stage = '检验' then qty else 0 end) xpjy from yourtable group by ....看看你的存储过程写的是什么 贴出来看看
换成decode就可以了。 case不行。
你可以用最简单的case测试一下,确实不行。
create or replace procedure aaa is aa varchar2(100); begin select case when 1=2 then '1' else '2' end into aa from dual; dbms_output.put_line( aa ); end; / declare i integer; begin aaa; end;
Compilation errors for PROCEDURE WIPTRACKER.AAAError: PLS-00103: 出现符号 "CASE"在需要下列之一时: (*-+allmodnull <an identifier><a double-quoted delimited-identifier> <a bind variable>tableavgcountcurrentdistinctmaxminpriorsql stddevsumuniquevarianceexecutetheforalltimetimestampinterval date<a string literal with character set specification> <a number><a single-quoted SQL string> Line: 5 Text: select case when 1=2 then '1' else '2' end into aa from dual;
(-+modnull<an identifier>
<a double-quoted delimited-identifier><a bind variable>table
avgcountcurrentmaxminpriorsqlstddevsumvarianceexecutethe
foralltimetimestampintervaldate
<a string literal with character set specification>
<a number><a single-quoted SQL string>
Line: 7
Text: case when stage = '检验' then sum(qty) end xpjy,
我试过,不可以的。
sum(case when stage = '检验' then qty else 0 end) xpjy,
case when stage = '检验' then sum(qty) end xpjy,
和你的写法
sum(case when stage = '检验' then qty else 0 end) xpjy,
单独作为sql语句执行都是可以的。
但是放在存储过程里面就不可以了。
case不行。
is
aa varchar2(100);
begin
select case when 1=2 then '1' else '2' end into aa from dual;
dbms_output.put_line( aa );
end;
/
declare
i integer;
begin
aaa;
end;
(*-+allmodnull
<an identifier><a double-quoted delimited-identifier>
<a bind variable>tableavgcountcurrentdistinctmaxminpriorsql
stddevsumuniquevarianceexecutetheforalltimetimestampinterval
date<a string literal with character set specification>
<a number><a single-quoted SQL string>
Line: 5
Text: select case when 1=2 then '1' else '2' end into aa from dual;