I have the following piece of code:
IF i.cd_ver IS NULL OR i.cd_ver = '0'
THEN
--Set value of v_cd_ver
v_cd_ver := CASE i.cd_ver
WHEN NULL
THEN '9'
WHEN '0'
THEN '10'
END;
END if;
"i" is the record found in the cursor referenced to an external table. The value is NULL or blank in the external table:
SELECT cd_ver FROM table_xtl WHERE cd_id = '123';
..This returned one row blank.
HOWEVER, v_cd_ver did not get set to '9' as expected. My work-around was to use IF THEN statements instead and it works. Why is the CASE statement not working as expected??
UPDATE: When I tried instead the following it worked:
v_cd_ver := CASE
WHEN i.cd_ver IS NULL
THEN '9'
WHEN i.cd_ver = '0'
THEN '10'
END;
Is this a bug or there's some reason why the former did not work?