Skip to Main Content

Null handling oracle

Abhisek SamantaApr 8 2019 — edited Apr 9 2019

Hi Experts,

I'm facing a strange issue which I didn't face earlier. DB - Oracle Database 12c Enterprise Edition Release - 64bit Production

I've a table lets say "tab_1" & a column in that "col1". Column is of varchar2 datatype & can store nulls.

Let's say i run the query to get distinct values & their respective counts. Below is the output.


Now if i run:

select * from tab_1 where col1 !='A' -- Gets me incomplete resultset.

select * from tab_1 where nvl(col1,0) !='A'  -- Gets me correct data.

So, my question is: Why am i not getting correct result in my 1st query? Why i need to put nvl for getting me correct stuff?

Pls. let me know if I need to brush my knowledge on null handlings & the way they're operated internally in oracle.

Or is there any component i have to ask my DBA to configure correctly.


This post has been answered by AndrewSayer on Apr 8 2019
Jump to Answer
Post Details
Added on Apr 8 2019