BusyAnt BusyAnt - 5 months ago 12
SQL Question

Replacing `(null)` with blank cell in SQL query result

I believe what I'm asking here is possible, but I haven't find a way yet :

Some cells in the result of my SQL SELECT-FROM-WHERE query are blank, and in DbVisualizer,

(null)
is written inside. I'd like to display a blank cell instead.

I've already tried with CASE-WHEN and the NVL operator, but it won't let me replace it by a blank
''
, I'm forced to use some
' '
or
'message'
.

I know I could just delete these spaces or messages with Excel later, but I'd like to know if there is a way to do it directly with DbVisualizer, instead of this workaround.

EDIT: Here is what my request looks like :

SELECT *things*,
CASE WHEN
(SELECT COUNT(*) FROM table d2 WHERE *join-condition* AND *other condition*) = 1
THEN
(*sub-select query*)
ELSE
''
END
AS NAME,
*other things*
FROM table d1
WHERE *something*


Thanks a lot !

Answer

The problem in your query is the following ELSE part of the CASE expression:

 ELSE
     ''

In Oracle, an empty string is considered as NULL value. So, all you need to do is use something else instead of ''.

For example, to use a space instead of NULL:

ELSE 
   ' '

Update The issue is the DbVisualizer tool. OP is on version 8.0.12. Prior to version 9.2.8 it cannot show NULL as an empty string. However, as discussed in this forum, it has been fixed in DbVisualizer 9.2.8.