Case syntax error [message #54058] |
Sat, 26 October 2002 17:56 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
boby george
Messages: 1 Registered: October 2002
|
Junior Member |
|
|
I have a strange problem...
when i execute the statement given below alone (independently) it works fine
update revenue a set a.status =
case
when (a.amount = (select sum(amount) from revenue b where a.confirmationno=b.confirmationno and b.date1 between(a.date1-1) and (a.date1+1) and b.trantype='PMT') )then 'C'
else 'P'
end
where a.trseqno=2 and a.trantype='AIR';
but when executed inside the SQL statement block given below it generates the error...
declare v_revenue revenue%rowtype;
begin
select * into v_revenue from revenue where trseqno=2;
update revenue a set a.status =
case
when (a.amount = (select sum(amount) from revenue b where a.confirmationno=b.confirmationno and b.date1
between(a.date1-1) and (a.date1+1) and b.trantype='PMT') )then 'C'
else 'P'
end
where a.trseqno=2 and a.trantype='AIR';
update revenue b set matchid = v_revenue.trseqno where
v_revenue.confirmationno=b.confirmationno and b.date1 between(v_revenue.date1-1) and (v_revenue.date1+1)
and b.trantype='PMT';
insert into revenue_match(trseqno, payid, amount, matchid)
(select a.trseqno, b.payid, b.amount, b.matchid from revenue a, revenue b
where a.confirmationno=b.confirmationno and b.date1 between(a.date1-1) and (a.date1+1) and
a.trseqno=2 and b.trantype='PMT');
end;
THe error generated is The following error has occurred:
ORA-06550: line 6, column 2:
PLS-00103: Encountered the symbol "CASE" when expecting one of the following:
( - + mod null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current max min prior sql stddev sum variance execute
forall time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string>
Details:
ORA-06550: line 6, column 2:
PLS-00103: Encountered the symbol "CASE" when expecting one of the following:
( - + mod null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current max min prior sql stddev sum variance execute
forall time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string>
Any pointers of help is much appreciated
Thanks
|
|
|
|
Re: Case syntax error [message #54882 is a reply to message #54058] |
Thu, 12 December 2002 09:28 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
Jay
Messages: 127 Registered: October 1999
|
Senior Member |
|
|
case statement is not supported by PL/SQL engine. It is only supported by sql Engine. 9iOracle supports this syntax both ways as there is no PL/sql engine anymore.
|
|
|