Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Not sure what I am missing here in my Sql Statement. I keep getting the [Error] Execution: (ORA-00907: missing right parenthesis error
LOAD
*;
SQL select
fact.TRANSACTION_TYPE_ID,
fact.TRANSACTION_DATE_ID,
fact.TRANSACTION_ID,
fact.MATERIAL_ID,
IF(detail.Order_Type = 'FOR','1','2') as FOR_TYPE_ID,
fact.BACKLOG_QUANTITY
from BACKLOG_WEEKLY_FACT_MV fact,
BACKLOG_HISTORY_MV detail
where fact.TRANSACTION_ID = detail.BACKLOG_HISTORY_ID;
Any help will be appreciated.
Thanks in advance,
Archie
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,
flipside
Hi,
If possible Can you post screen shot of your error???
Regards
Why dont you try Prelaod and do all calculations/joins in QV script rather than in SQL script.
ex:
Load *, IF(match(Order_Type =,'FOR','1','2'),Order_Type ) as FOR_TYPE_ID;
SQL Select *
From Detail;
Inner Join
Load *;
SQL Select *
From Fact;
I used * but you should use only the fields you want.
Thanks
AJ
Hi,
Several Possibilities,
Like
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,
Regards,
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,
flipside
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.