sql - Converting Access IIF to oracle -


this question has answer here:

having issues converting iif(vw_ge_all_yearqry.dep="ag","ag","ot") dept, oracle

select vw_ge_all_yearqry.year, vw_ge_all_yearqry.loc, vw_ge_all_yearqry.cat, vw_ge_all_yearqry.ty, (case when vw_ge_all_yearqry.dep = 'ag' 'ag' else 'ot' end) dept, vw_ge_all_yearqry.srce, sum(vw_ge_all_yearqry.expend * 0.001) exp vw_ge_all_yearqry group vw_ge_all_yearqry.year, vw_ge_all_yearqry.loc, vw_ge_all_yearqry.cat, vw_ge_all_yearqry.ty, (case when vw_ge_all_yearqry.dep = 'ag' 'ag' else 'ot' end) dept, vw_ge_all_yearqry.srce having (((sum(vw_ge_all_yearqry.expend * 0.001)))<>0); 

the query tells me have error, seems trivial @ point

error @ command line:11 column:169 error report: sql error: ora-00933: sql command not ended 00933. 00000 -  "sql command not ended" *cause:     *action: 

if issue 1 in text, easy. use case (which ansi standard):

(case when vw_ge_all_yearqry.dep = 'ag' 'ag' else 'ot' end) dept 

here full version of query:

select v.year, v.loc, v.cat, v.ty,        (case when vw_ge_all_yearqry.dep = 'ag' 'ag' else 'ot' end) dept        v.srce,        sum(v.expend * 0.001) exp vw_ge_all_yearqry v group v.year, v.loc, v.cat, v.ty,          (case when vw_ge_all_yearqry.dep = 'ag' 'ag' else 'ot' end), v.srce having sum(v.expend * 0.001) <> 0; 

i have simplified using table aliases. , removed as dept group by clause. and, replaced double quotes strings single quoted strings.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -