The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.
Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!
Does Vertica CASE statement (syntax form 2) recognize NULL values?
edited September 2021 in General Discussion
Sorry! I now see this was previously answered
How can I get Vertica CASE statement syntax form 2 to recognize NULL values?
For instance, the following query I would expect and prefer it to recode empty strings to
9 or even
8 but it falls through to the else clause and returns
7. Is this the expected behavior?
SELECT ( CASE status WHEN 'Yes' THEN 1 WHEN 'Reviewed and blocked' THEN 0 WHEN NULL THEN 9 WHEN '' THEN 8 ELSE 7 END ) AS coded, COUNT(*) AS freq FROM myschema.mytable GROUP BY 1
You have to handle NULL a little differently...
Or like in that link...