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

Home -> Community -> Usenet -> c.d.o.server -> Re: Am I crazy or what?

Re: Am I crazy or what?

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Fri, 13 May 2005 22:00:58 -0700
Message-ID: <1116046608.38345@yasure>


gaby_at_ieee.org wrote:

> Hi,
>
> I'm using the ojdbc14.zip JDBC driver againts an oracle 10g database.
>
> I'm getting one crazy result from a select.
>
> select ...,nvl(attr,'') as attr, ...
> from .... where ...
>
> The attr attribute is a varchar2(150) that allow nulls.
>
> I do resultSet.getString("attr") and it returns me NULL for that
> attribute!!
>
> Is there *any* condition under which the nvl function doesn't return
> null?
>
> *What* is what I'm doing wrong, for the love of God?
>
> TIA,
> Gabriel

Not crazy but ignorant. Which ... don't take this personally ... applies to about 98% of all Java developers that are given access to databases. Not more than a handful of you folks, in the last 5 years of experience I've had, has ever read the concept and architecture manuals of the database against which you are working.

You just treat the database like a file system and then stare in amazement when it doesn't do what you expect.

In this case it has been an Oracle default from likely before you were born that in Oracle an empty string is equivalent to NULL.

And no diety or dieties had a thing to do with it.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Sat May 14 2005 - 00:00:58 CDT

Original text of this message

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