Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sql question...
As the oracle manual explains somewhere (I think in the SQL Reference
guide) -
NULL !=(or any other logical operator like =,<,etc) 'Anything'
has logical value unknown (and effectively false). Thus to get the NULL values u need to add to your #1 query:
or fellow is NULL.
Thus anytime u have null values u have to explicitly check for them use 'is NULL' or is not NULL etc.
or u can use the nvl() function to conver null values to a value: so
for #1 u could use:
where nvl(fellow,'XYZ') != 'Y'
Hope this helps.
raj
-- Raj Agarwal RKA Technology Inc. 81 Richland Drive, Berkeley Hts, NJ 07922 USA 908 464 8003 FAX: 908 464 1003 rka.ra_at_worldnet.att.net oispeggy_at_acsu.buffalo.edu wrote in article <Pine.GSO.3.96.970612151549.25962D-100000_at_xena.acsu.buffalo.edu>...Received on Fri Jun 13 1997 - 00:00:00 CDT
>
> Learn something new every day....
>
> 1.
> select lname, fname This returns everyone with 'N' or 'G' or '
'.
> from resdemo None with 'Y'. None with null.
> where fellow != 'Y'
>
> 2.
> select lname, fname This returns only those with null.
> from resdemo
> where fellow is null
>
> 3.
> select lname, fname This returns only those with ' '.
> from resdemo
> where fellow = ' '
>
>
> What surprised me is that #1 did not return anyone with a null value?
> I thought it would? Why didn't it?
>
> Thanks,
>
> - Peggy -
> oispeggy_at_acsu.buffalo.edu
>
>
![]() |
![]() |