Counting null values as unique value Counting null values as unique value oracle oracle

Counting null values as unique value


select  count(distinct col1) + count(distinct case when col1 is null then 1 end)from    YourTable


if hour is a number, then if it can only be an integer:

select count(distinct coalesce(hour, 0.1)) cnt from test;

otherwise if it can be any floating point, change NULL to a char string.

eg

select count(distinct coalesce(to_char(hour), 'a')) cnt from test;


select    count(0) from  (      select distinct hour from hours  )

SqlFiddle