Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: JDBC Driver setObject() converts empty string to NULL

Re: JDBC Driver setObject() converts empty string to NULL

From: Robert Klemme <bob.news_at_gmx.net>
Date: Wed, 31 May 2006 11:39:23 +0200
Message-ID: <4e56ibF1d1jutU1@individual.net>


Thomas Kellerer wrote:
>
> On 31.05.2006 10:08 Robert Klemme wrote:

>> Vladimir M. Zakharychev wrote:
>>> Hmm... Not exactly clear what the problem is, but I'll try:
>>> in Oracle, empty strings *are* NULLs. This is known and
>>> documented behavior. setString() or setObject() probably
>>> convert empty strings to NULLs because they are the
>>> same thing in Oracle. You need to code for this behavior
>>> as it can't be turned off.
>>
>> Thanks for the hint.  I can't believe that this slipped by me until 
>> now.  For interested parties, here is a simple test:
>>

>
> This is very well documented:
>
> http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/sql_elements5a.htm#59112

Oh, please stop it. I'm embarrassed enough that I didn't know it. :-}

> Interesting enough they claim "this may not continue to be true in
> future releases". But this has been true since Oracle 7 up to 10 and I
> don't really believe this will be changed ;)

Doesn't look like it would although they say "... and Oracle recommends that you do not treat empty strings the same as nulls."

Shudder

        robert Received on Wed May 31 2006 - 04:39:23 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US