Reputation: 3611
I have a column in a table that is blank. The weird thing is that it does not appear to be null or an empty string. So, if I do this:
SELECT *
FROM TABLE
WHERE column IS NULL
...or:
SELECT *
FROM TABLE
WHERE column = ''
I get nothing. Thoughts?
Upvotes: 10
Views: 45104
Reputation: 146660
Issue this query:
SELECT column, DUMP(column, 1016)
FROM table
It'll show the exact contents.
Related: Oracle does not allow empty strings; they're silently converted to NULL
.
Upvotes: 16
Reputation: 79243
If your column is not VARCHAR2
but CHAR(N)
then insertion of an empty string is padded. See what Tom Kyte tells about this
Upvotes: 1
Reputation: 360922
Oracle's got a basically permanent annoyance that empty strings are treated as null. However, are you sure that's an empty string? It could be an otherwise invisible character, such as a space or tab/linebreak/linefeed/etc... What does the string length show when you do select length(column) from table
?
Upvotes: 3
Reputation:
Maybe the column contains only spaces?
Did you try
select * from table where trim(column) is null
Upvotes: 16