Question

First sorry for the title, I know it's not clear but I couldn't find a better one! I have a Crystal report. This report doesn't use a command (sql query) to grab data from the oracle database. The previous developer used links between tables so the query is generated dynamically.

I used the menu "Show Sql Query" to see the generated sql query. The reason why I generated the sql query is because some records didn't show up in the result, so I wanted to execute the query in SQL Developer and I found the problem and trust me it's a very weird one. In fact, in the WHERE clause there is this filter (TableX.FieldY <> 'blabla'). Normally it should include the rows that contain NULL in that column, but that's not the case!

In the result, oracle doesn't show the rows that have a null value in that column ! I believe that null is different from 'blablabla', so why the records with null value in that column don't show up? Could you please help me? Plus, even if the solution is to modify something in the query, i will not be able to modify the query because it's auto-generated by Crystal report. Thank you so much for your precious help.

Walloud

Était-ce utile?

La solution

NULL doesn't equal anything. NULL has it's own comparison, IS NULL, or IS NOT NULL:

 TableX.FieldY <> 'blabla'
OR  TableX.FieldY IS NULL
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top