Oracle Sql Count Distinct Case Statement Verilog