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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: is null / = null query

RE: is null / = null query

From: Javier Morales <Javier_at_infojobs.net>
Date: Fri, 10 Nov 2000 16:10:12 +0100
Message-Id: <10676.121717@fatcity.com>


no way... Oracle ALWAYS knows every value... it's a null comparation = of
values, so, It's something like that...

select salary*12+commision
from employee;

so, the result will be:
salary*12+commision (If commision is NOT a null value) or NULL (If commision has a null value...)

so, Oracle understands it like that:

" ok, if Salary=3D1000$
and Commision -> NULL

1000*12+"I_DONT_KNOW_THE_VALUE"=20
.... hmmmm...
... so, the result is: "I_DONT_KNOW_THE_VALUE" !! ;-))

It's just a sintax paradox (maybe a contradiction...) It's just to tell you that the correct sintax is using "IS NULL" = clause...

so, remember that if you want to make operations, you would have to use = the
NVL function... ;-)

hope this would help...
Regards



 Javier Morales - javier_at_infojobs.net
 Administraci=F3n Bases de Datos Oracle - InfoJobs.net  Tel. +34 902 10 60 90 Ext. 2067
 Fax. +34 (93) 580 56 60
=20

-----Mensaje original-----
De: GKor_at_rdw.nl [mailto:GKor_at_rdw.nl]
Enviado el: viernes 10 de noviembre de 2000 13:45 Para: Multiple recipients of list ORACLE-L Asunto: RE: is null / =3D null query

why would you know those results in the first place ? you search = something
but you are not sure what exactly ?

> -----Oorspronkelijk bericht-----
> Van: Javier Morales [SMTP:Javier_at_infojobs.net]
> Verzonden: 10-nov-00 13:20
> Aan: Multiple recipients of list ORACLE-L
> Onderwerp: RE: is null / =3D null query

>=20

> Null =3D I_DONT_KNOW_THE_VALUE
>=20
>=20
>=20

> SELECT COUNT(*) FROM WERK_ORDER WHERE RESULT_CODE_WO =3D NULL;
> 0
> 1 row selected.
>=20

> Oracle is saying something like that...
> "you asked me for counting the fields where the RESULT_CODE_WO field =
has
> an
> unknown value... but I know the values of EVERY RECORD... including =
the
> null values... (wich value is "I_DON'T_KNOW_THE_VALUE" ...)
>=20
>=20
>=20
>=20

> SQL> SELECT COUNT(*) FROM WERK_ORDER WHERE RESULT_CODE_WO IS NULL;
> 301
>=20

> 1 row selected.
>=20

> Oracle is saying something like that...
> "you asked me for counting the fields where the RESULT_CODE_WO field =
has a
> "I_DONT_KNOW_THE_VALUE" value... so I found 301 NULL values in that =
field"
>=20
>=20
>=20

> ... I hope you understand now!!... eheh... It's a bit complex at the
> begining of all, but It's just to get the trick !! ;-))
>=20

> Regards,
> Javier=20
> ---------------------------------------
> Javier Morales - javier_at_infojobs.net
> Administraci=F3n Bases de Datos Oracle - InfoJobs.net
> Tel. +34 902 10 60 90 Ext. 2067
> Fax. +34 (93) 580 56 60
> =20
>=20
>=20
>=20
>=20
>=20
>=20
>=20

> -----Mensaje original-----
> De: Rao, Maheswara [mailto:Maheswara.Rao_at_Sungardp3.com]
> Enviado el: jueves 9 de noviembre de 2000 17:06
> Para: Multiple recipients of list ORACLE-L
> Asunto: RE: is null / =3D null query
>=20
>=20

> Gkor,

>=20
> When you want to compare null you use the clause IS NULL . =
Alternately, IS
> NOT NULL.

>=20
> As per your query, the second query is returning the result =
correctly.
> The
> first query returned zero rows because =3DNULL did not work.
>=20

> Now, please clarify, what exactly you mean by saying that you did not
> expect
> to get answer from the first query?
>=20

> Rao
>=20

> Maheswara.Rao_at_SunGardP3.com
>=20

> -----Original Message-----
>=20

> I have launched the following query in SQL*PLUS
>=20

> SQL> L
> 1* SELECT COUNT(*) FROM WERK_ORDER WHERE RESULT_CODE_WO =3D NULL;
> SQL> /
> 0
>=20

> 1 row selected.
>=20

> SQL> SELECT COUNT(*) FROM WERK_ORDER WHERE RESULT_CODE_WO IS NULL;
> 301
>=20

> 1 row selected.
>=20

> SQL>
>=20

> i did'nt expect to get answer on the first query anyone with an
> explanation
> or is this a undocumented feature ?
>=20

> thanks
>=20

> gkor_at_rdw.nl
> rdw the netherlands
> --
>=20

> --=20
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --=20
> Author: Rao, Maheswara
> INET: Maheswara.Rao_at_Sungardp3.com
>=20

> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing =
Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
> --=20
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --=20
> Author: Javier Morales
> INET: Javier_at_infojobs.net
>=20

> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing =
Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
--=20
Please see the official ORACLE-L FAQ: http://www.orafaq.com --=20
Author:=20
  INET: GKor_at_rdw.nl
Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in Received on Fri Nov 10 2000 - 09:10:12 CST

Original text of this message

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