dbTalk Databases Forums  

Simple SQL request - I must be missing something obvious...

comp.databases.oracle.server comp.databases.oracle.server


Discuss Simple SQL request - I must be missing something obvious... in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Syltrem
 
Posts: n/a

Default Simple SQL request - I must be missing something obvious... - 11-26-2010 , 04:01 PM






Hello

It must be an obvious thing I can't see because it's late Friday
afternoon...

Why does the last request return nothing ?


SQL> insert into ifa_security (PROGRAM_NAME) values ('TEST');

1 ligne créée.

SQL> select PROGRAM_NAME from ifa_security where PROGRAM_NAME = 'TEST';

PROGRAM_NAME
--------------------------------
TEST

1 ligne sélectionnée.

SQL> select PROGRAM_NAME from ifa_security where DML_CALLED = 'TEST';

aucune ligne sélectionnée

SQL> select PROGRAM_NAME from ifa_security where PROGRAM_NAME not in (select
DML_CALLED from ifa_security);

aucune ligne sélectionnée

SQL>



On the other hand,

SQL> select PROGRAM_NAME from ifa_security a where not exists (select 1 from
ifa_security where DML_CALLED = a.PROGRAM_NAME);

PROGRAM_NAME
--------------------------------
TEST

1 ligne(s) sélectionnée(s).



What's wrong with the NOT IN ?

Thank you !
Syltrem

Reply With Quote
  #2  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: Simple SQL request - I must be missing something obvious... - 11-26-2010 , 08:07 PM






On Fri, 26 Nov 2010 17:01:50 -0500, Syltrem wrote:

Quote:
What's wrong with the NOT IN ?

Thank you !
Syltrem
NULL values. See here:
http://articles.techrepublic.com.com...1-5319615.html



--
http://mgogala.freehostia.com

Reply With Quote
  #3  
Old   
Syltrem
 
Posts: n/a

Default Re: Simple SQL request - I must be missing something obvious... - 11-26-2010 , 08:21 PM



"Mladen Gogala" <gogala.mladen (AT) gmail (DOT) com> a écrit dans le message de news:
icpp5l$jam$8 (AT) solani (DOT) org...
Quote:
On Fri, 26 Nov 2010 17:01:50 -0500, Syltrem wrote:

What's wrong with the NOT IN ?

Thank you !
Syltrem

NULL values. See here:
http://articles.techrepublic.com.com...1-5319615.html



--
http://mgogala.freehostia.com
Right.
I kind of remembered something about nulls but not quite, and I was not
expecting any nulls in the result set...

Thanks for that !
Syltrem

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.