i have a problem with CASE sintax (I think) and I hope you can help me. I'll try to explain my problem:
I have 2 fields DV_CODE e DV_NAME and I would like to have DV_NAME = 'Other person' if I haven't the code, that means DV_CODE = null
This is my code:
SELECT rep_code,
name,
act_date,
dv_code,
CASE
WHEN DUAL_CODE_AM IS NULL THEN DV_NAME= 'Other person'
WHEN DUAL_CODE_PM IS NULL THEN DV_NAME= 'Other person'
END
AS dv_name
......
(in my case "else"statment is useless)
but system returns to me 2 errors:
or: missing keyword or: missing parenthesis
thanks in advance.
DV_CODE IS null, but then in your sample code you checkDUAL_CODE_AM IS NULLandDUAL_CODE_PM?? so what are you checking for NULL?DV_CODE,DUAL_CODE_AM, orDUAL_CODE_PM?