Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Am I crazy or what?
gaby_at_ieee.org schrieb:
> 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
>
As the empty string is regarded by Oracle as NULL, your result is correct. NVL would return not null in case you specify the second argument to be NOT NULL too.
Best regards
Maxim Received on Fri May 13 2005 - 16:45:23 CDT