Can someone help me fix the error?
SQL Expression:
if ('X' <= 14000 and 'X' >= 10000) then "10-14"
elseif ('X' <= 10000 and 'X' >= 8500) then "8.5-10"
elseif ('X' < 14000) then "U/14"
elseif ('X' > 14000) then "O/14"
else "U/8.5"
endif
ERROR:
Formula In-DB (35) Error SQLPrepare: [Hortonworks][Hardy] (80) Syntax or semantic analysis error thrown in server while execurint query. Error message from server: Error while compiling statement: FAILED: ParseException line 1:499 mismatched input 'then' expecting ) near ')' in function specification.
Thanks!
Solved! Go to Solution.
Try to use case..when...then instead of if..then.
Cheers,
While I am not a hortonworks expert, I dont think that CASE [Col] WHEN [Cond] THEN [Outcome] will work because of the use of >, >=, <, <= operators.
I would try removing the final 'if' from the endif, as in SQL operators, an if statement is usually ended by a simple end, not endif.