hazelsisson
Programmer
Hi all,
I've devised a CASE statement for use within my stored procedure SQL insert query but then found out it doesn't work in our version of Oracle.
(The error message is PLS-00103: Encountered the symbol "CASE" when expecting one of the following: ( - + mod not null others <an identifier>).
Is there any way to re-write my case statement as a Decode statement?
I've simplified the query to show you, but hopefully you can get the idea - the case statement just sets an indicator to 'Y' if any value of j.journey_date is less than the bind variable :sdate.
I have tried replacing the case statement with a local function to return the desired result but this didn't work as it's an insert over a database link and required changing some global parameters which I cannot change.
Many thanks,
Hazel
I've devised a CASE statement for use within my stored procedure SQL insert query but then found out it doesn't work in our version of Oracle.
(The error message is PLS-00103: Encountered the symbol "CASE" when expecting one of the following: ( - + mod not null others <an identifier>).
Is there any way to re-write my case statement as a Decode statement?
I've simplified the query to show you, but hopefully you can get the idea - the case statement just sets an indicator to 'Y' if any value of j.journey_date is less than the bind variable :sdate.
Code:
insert into zcmintranet@hrtest
( zcmi_con_no, zcmi_car_reg, zcmi_mls_ntx, zcmi_old_clm )
select u.emp_num, j.reg_num, (sum(j.total_miles) - sum(nvl(j.h2o_miles,0))) nt,
[COLOR=red](CASE when min(j.journey_date) < :sdate then 'Y' else '' end) old_claim[/color]
from cm_users u, cm_claims c, cm_journeys j
where u.emp_num=c.emp_num
and c.claim_num=j.claim_num
and trunc(j.approval_date) between trunc(:sdate) and trunc(:edate)
group by u.emp_num, j.reg_num
I have tried replacing the case statement with a local function to return the desired result but this didn't work as it's an insert over a database link and required changing some global parameters which I cannot change.
Many thanks,
Hazel