Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C3C52F.134241F0"
------_=_NextPart_001_01C3C52F.134241F0
Content-Type: text/plain;
charset="ISO-8859-1"
Doess the column crs.os_id_fk1 contain nulls?
Regards
Naveen
-----Original Message-----
Sent: Thursday, December 18, 2003 10:54 AM
To: Multiple recipients of list ORACLE-L
Hi Gurus,
I have a problem using NOT IN clause in Oracle. However using NOT EXISTS,
gives me the right output. Are there any known limitations.
This query selects from the master records wherein child records are not
active.
select * from ct_software_release csr where
csr.class = 'NS'
AND csr.active_flag = 'Y'
AND csr.os_id_pk not IN
(SELECT crs.os_id_fk1 FROM CT_ROADMAP_SOFTWARE crs
WHERE crs.active_flag = 'Y');
The sub-query in the above case gives 1800 rows. The above query fails to
give any rows.
select * from ct_software_release csr where
csr.class = 'NS'
AND csr.active_flag = 'Y'
AND NOT EXISTS
(SELECT 1 FROM CT_ROADMAP_SOFTWARE crs
WHERE crs.os_id_fk1 = csr.os_id_pk
AND crs.active_flag = 'Y');
This above query works fine.
Thanks
Siddharth Haldankar
Zensar Technologies Ltd.
Cisco Systems Inc.
(Offshore Development Center)
# : 091 020 4128394
shaldank_at_cisco.com <mailto:shaldank_at_cisco.com>
s.haldankar_at_zensar.com <mailto:s.haldankar_at_zensar.com>
------_=_NextPart_001_01C3C52F.134241F0
Content-Type: text/html;
charset="ISO-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META content="MSHTML 6.00.2462.0" name=GENERATOR>
<STYLE>@font-face {
font-family: Microsoft Sans Serif;
}
@page Section1 {size: 595.45pt 841.7pt; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Arial
}
LI.MsoNormal {
FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Arial
}
DIV.MsoNormal {
FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: Arial
}
A:link {
COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline
}
P.MsoPlainText {
FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Courier New"
}
LI.MsoPlainText {
FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Courier New"
}
DIV.MsoPlainText {
FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Courier New"
}
SPAN.EmailStyle17 {
FONT-WEIGHT: normal; COLOR: windowtext; FONT-STYLE: normal; FONT-FAMILY: "Microsoft Sans Serif"; TEXT-DECORATION: none
}
DIV.Section1 {
page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV><SPAN class=515151206-18122003><FONT face="Courier New" color=#0000ff
size=2>Doess the column crs.os_id_fk1 contain nulls? </FONT></SPAN></DIV>
<DIV><SPAN class=515151206-18122003><FONT face="Courier New" color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=515151206-18122003><FONT face="Courier New" color=#0000ff
size=2>Regards</FONT></SPAN></DIV>
<DIV><SPAN class=515151206-18122003><FONT face="Courier New" color=#0000ff
size=2>Naveen</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Siddharth Haldankar
[mailto:shaldank_at_cisco.com]<BR><B>Sent:</B> Thursday, December 18, 2003 10:54
AM<BR><B>To:</B> Multiple recipients of list ORACLE-L<BR><B>Subject:</B> Any
known problems using NOT IN ?<BR><BR></FONT></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">Hi
Gurus,</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">I have a problem
using NOT IN clause in Oracle. However using NOT EXISTS, gives me the right
output. Are there any known limitations.</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">This query
selects from the master records wherein child records are not
active.</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">select * from
ct_software_release csr where </SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
csr.class =
'NS'</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
AND csr.active_flag = 'Y'</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
AND csr.os_id_pk not IN</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'"> (SELECT
crs.os_id_fk1 FROM CT_ROADMAP_SOFTWARE crs</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
WHERE crs.active_flag = 'Y');</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">The sub-query in
the above case gives 1800 rows. The above query fails to give any
rows.</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">select * from
ct_software_release csr where </SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
csr.class =
'NS'</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
AND csr.active_flag = 'Y'</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
AND NOT EXISTS</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
(SELECT 1 FROM CT_ROADMAP_SOFTWARE crs</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
WHERE crs.os_id_fk1 = csr.os_id_pk </SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
AND crs.active_flag =
'Y');
</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">This above query
works fine.</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'"></SPAN></FONT> </P>
<P class=MsoPlainText><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">Thanks</SPAN></FONT></P>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT
face="Microsoft Sans Serif" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">
<HR align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoPlainText><B><FONT face="Microsoft Sans Serif" size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: 'Microsoft Sans Serif'">Siddharth
Haldankar</SPAN></FONT></B></P>
<P class=MsoPlainText><FONT face="Microsoft Sans Serif" color=gray
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Microsoft Sans Serif'">Zensar
Technologies Ltd.</SPAN></FONT></P>
<P class=MsoPlainText><FONT face="Microsoft Sans Serif" color=gray
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Microsoft Sans Serif'">Cisco
Systems Inc. </SPAN></FONT></P>
<P class=MsoPlainText><FONT face="Microsoft Sans Serif" color=gray
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Microsoft Sans Serif'">(Offshore
</SPAN></FONT><FONT face="Microsoft Sans Serif" color=gray><SPAN
style="COLOR: gray; FONT-FAMILY: 'Microsoft Sans Serif'">Development</SPAN></FONT><FONT
face="Microsoft Sans Serif" color=gray><SPAN
style="COLOR: gray; FONT-FAMILY: 'Microsoft Sans Serif'"> </SPAN></FONT><FONT
face="Microsoft Sans Serif" color=gray><SPAN
style="COLOR: gray; FONT-FAMILY: 'Microsoft Sans Serif'">Center</SPAN></FONT><FONT
face="Microsoft Sans Serif" color=gray><SPAN
style="COLOR: gray; FONT-FAMILY: 'Microsoft Sans Serif'">)</SPAN></FONT></P>
<P class=MsoPlainText><FONT face="Microsoft Sans Serif" color=gray
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Microsoft Sans Serif'">#
: 091 020 4128394</SPAN></FONT></P>
<P class=MsoPlainText><FONT face="Microsoft Sans Serif" color=gray
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Microsoft Sans Serif'"><A
href="mailto:shaldank_at_cisco.com">shaldank_at_cisco.com</A></SPAN></FONT></P>
<P class=MsoPlainText><FONT face="Microsoft Sans Serif" color=gray
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Microsoft Sans Serif'"><A
href="mailto:s.haldankar_at_zensar.com">s.haldankar_at_zensar.com</A>
</SPAN></FONT></P>
<P class=MsoPlainText><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt"></SPAN></FONT> </P></DIV></BLOCKQUOTE></BODY></HTML>
------_=_NextPart_001_01C3C52F.134241F0--
------=_NextPartTM-000-708dc590-dd95-4632-9f10-c3a812eee758--
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Naveen, Nahata (IE10)
INET: Naveen.Nahata_at_honeywell.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com
San Diego, California -- Mailing list and web hosting services
---------------------------------------------------------------------
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).
Received on Thu Dec 18 2003 - 00:29:26 CST