SQLPLUS seems to show zeros and empty lines for the CLOB in a way that I did not expect.
Try the following in SQLPLUS (I am using Oracle 10g server). Create a table with CLOB and insert zero, empty clob, and what I think of as an empty string:
create table tableA (field1 number, field2 clob); insert into tableA values (1, null); insert into tableA values (2, empty_clob()); insert into tableA values (3, '');
OK, let's make some queries, but first we need to say SQLPLUS to show us the unique values:
set null {NULL}
In the following query, I would expect only row 1 to return, but it returns 2:
select * from tableA where field2 is null; field1 field 2
Hmm, why is '' stored as null in the CLOB?
Ok, so based on this result, I expect the following query to return all 3 rows, but will only show {NULL} in lines 1 and 3. However, I get this result:
select * from tableA; field1 field 2
This is confusing. I thought there were only 2 zeros, although I expected 1. So, what is going on here? Does set null for the CLOB, and if so, what should I use instead?
I am actually trying to solve another problem with null CLOB values, but this confusing behavior made me run rings for a while, so I would like to understand this before proceeding.
Thank you in advance
Boz