I’m creating a query with a condition depending on the result of a variable.
- If PROD = ‘alpha’ I need to show only models 2,3,4,5 and 6;
- if PROD = ‘beta’ that only models 0 and 1 appear.
DEFINE PROD = 'ALPHA' SELECT CAR_CODE, CAR, MODELS FROM TB_CAR_MODELS WHERE ( CASE PROD WHEN 'ALPHA' THEN MODELS IN (2,3,4,5,6) WHEN 'BETA' THEN MODELS IN (0,1) END );
I created this query but it’s not working. Returns the error:
- 00000 – “missing keyword”
Can you help me please? Thanks