> > being a long-time Oracle DBA/programmer (since version 7), data-wise I 
> > don't understand what an empty string could be besides a NULL
>
> That's understandable. You have been brainwashed :-)

We all have!

> By the way: does Oracle convert empty byte
> arrays to NULL as well?

Interestingly, yes:

---------------------------------------------------------------------------
        create table lob_test(lob blob);

        PreparedStatement stmt;
        stmt = connection.prepareStatement("insert into lob_test
values (?)");
        stmt.setBytes(1, null);
        stmt.execute();

        stmt.setBytes(1, new byte[0]);
        stmt.execute();

        stmt.setBytes(1, "abc".getBytes());
        stmt.execute();

        -- This doesn't work (NullPointerException)
        stmt.setBlob(1, new oracle.sql.BLOB((OracleConnection)
connection));
        stmt.execute();

        -- Neither does this (NullPointerException)
        stmt.setBlob(1, new oracle.sql.BLOB((OracleConnection)
connection), null);
        stmt.execute();

        -- But this does
        stmt.setBlob(1, new oracle.sql.BLOB((OracleConnection)
connection, new byte[0]));
        stmt.execute();

        -- returns three records
        select * from lob_test where lob is null;

        -- returns one record
        select * from lob_test where lob is not null;
---------------------------------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to