ewgf2002
asked on
I am getting the following error when using a CASE statement in oracle ORA-00904
I am getting the following error when executing a case statement in oracle: ORA-00904
Remove the parentheses -
...,
Case when pm.frequnit = 'DAYS' then '1'
when pm.frequnit = 'WEEKS' then '7.0192307697'
else '30.41666667'
End as "GAIL",
...
...,
Case when pm.frequnit = 'DAYS' then '1'
when pm.frequnit = 'WEEKS' then '7.0192307697'
else '30.41666667'
End as "GAIL",
...
ASKER
I removed the parens, but now I am getting:
ORA-00923 FROM keyword not found where expected
ORA-00923 FROM keyword not found where expected
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Did that now I get : ORA-00907 missing right parenthesis
Can you copy the query plus the error message from your screen and paste it here?
ASKER
I had an extra paren which was not needed. Everything worked great. Thanks awking00!!!
Glad to help :-)
ASKER
as jpdesc, pm.assetnum, pm.frequency, pm.nextdate, pm.location, pm.crewid, pm.frequnit, pm.lead,pm.description
as pm_description,asset.descr
as asset_description,jobplan.
as pmseq_jpnum, pm.pmnum, pm.siteid,PMSEQUENCE.INTER
PM.JPSEQINUSE, pm.STATUS,
(CASE
WHEN pm.frequnit = 'DAYS' THEN '1'
WHEN pm.frequnit='WEEKS' THEN '7.0192307697'
ELSE '30.41666667' END) AS "GAIL",
(CASE WHEN PM.JPSEQINUSE='1' THEN 'YES'
WHEN PM.JPSEQINUSE='0' THEN 'NO'
ELSE ' ' END) as "JPSEQ",
(((PMSEQUENCE.INTERVAL*(Ab
FROM MAXIMO.PMSEQUENCE, MAXIMO.JOBPLAN, MAXIMO.PM, MAXIMO.ASSET
WHERE JOBPLAN.JPNUM = PMSEQUENCE.JPNUM
AND PM.PMNUM = PMSEQUENCE.PMNUM
AND PM.ASSETNUM = ASSET.ASSETNUM
and pm.siteid = :mrosite
order by pm.assetnum