Discussion Board for collaboration on QlikView Scripting.
Not sure what I am missing here in my Sql Statement. I keep getting the [Error] Execution: (ORA-00907: missing right parenthesis error
IF(detail.Order_Type = 'FOR','1','2') as FOR_TYPE_ID,
from BACKLOG_WEEKLY_FACT_MV fact,
where fact.TRANSACTION_ID = detail.BACKLOG_HISTORY_ID;
Any help will be appreciated.
Thanks in advance,
Go to Solution.
Try using a case statement instead of the if statement ...
CASE WHEN detail.Order_Type = 'FOR' THEN '1' ELSE '2' END as FOR_TYPE_ID,
If possible Can you post screen shot of your error???
Why dont you try Prelaod and do all calculations/joins in QV script rather than in SQL script.
Load *, IF(match(Order_Type =,'FOR','1','2'),Order_Type ) as FOR_TYPE_ID;
SQL Select *
I used * but you should use only the fields you want.
1> Try your select statement without If statement.
2>Try to give alise name for FOR_TYPE_ID i.e. it is coming from "detail" or "fact"
in your if expression IF(detail.Order_Type = 'FOR','1','2') as FOR_TYPE_ID,
That should work, though I usually bring in everything to a QVD then do the transformation in the Load Script of the Qvw.
Far easier scripting in Qlikview !
I agree, but I always find it is useful to know the proper logic in case I do need it later !
Thanks so much!
The Case Statement did the trick
Appreciate your help.