SQL case statement not executing 'else' I am on Oracle 12.1.0.2.0
I have a query that I wrote utilizing a CASE statement. I have 2 "WHEN" statements and one "ELSE" statement. The query is working as expected except for the "ELSE" statement. I get no syntax errors it just not hitting the "ELSE" case when it should, and instead returns nothing.

SELECT 
CASE
WHEN COUNT(COLUMN_A) = 1
    THEN 'PASS'
WHEN COUNT(COLUMN_A) &gt; 1
    THEN 'FAIL'
ELSE 'DOES NOT EXIST'
END AS TEST,
SCH.COLUMN_A
FROM SCHEMA.TABLE_A SCH
WHERE SCH.COLUMN_A = 'NA'
GROUP BY COLUMN_A


When I run this query (which in my understanding is the else case) then it returns 0 as it should:

SELECT COUNT(COLUMN_A) &lt; 1
FROM SCHEMA.TABLE_A SCH
WHERE SCH.COLUMN_A = 'NA'


If you need to provide table structure, let me know but it is fairly straightforward.

What am I doing wrong? Why, when the query returns 0, is the else statement not returning "DOES NOT EXIST"? I have a feeling it is something simple but I am stuck and could use some help. I appreciate it.
You used this predicate: COLUMN_A = 'NA'

The result of COUNT(COLUMN_A) can be 0 only if you have 0 rows where COLUMN_A = 'NA' (as nulls are excluded because of the predicate). If you have 0 rows, the CASE statement is not evaluated at all, and the above query returns no result.

You need a query that returns result even if no rows match your predicate. E.g:

SELECT 
  CASE
    WHEN C = 1
      THEN 'PASS'
    WHEN C &gt; 1
      THEN 'FAIL'
    ELSE 'DOES NOT EXIST',
    'NA'
FROM
(
  SELECT COUNT(*) AS C
  FROM SCHEMA.TABLE_A SCH
  WHERE SCH.COLUMN_A = 'NA'
);