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: SQL help

RE: SQL help

From: Jamadagni, Rajendra <Rajendra.Jamadagni_at_espn.com>
Date: Thu, 12 Sep 2002 14:03:23 -0800
Message-ID: <F001.004CF175.20020912140323@fatcity.com>


Content-Type: multipart/alternative;
 boundary="----_=_NextPart_001_01C25A9F.76CECF00" ------_=_NextPart_001_01C25A9F.76CECF00
Content-Type: text/plain;
 charset="iso-8859-1"

Not tested .... but

select sysdate, 'test1','test2'
from dual
where exists ( your union clause)
union
your_union_clause

Raj



Rajendra Jamadagni MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

QOTD: Any clod can have facts, but having an opinion is an art!

-----Original Message-----
Sent: Thursday, September 12, 2002 5:48 PM To: Multiple recipients of list ORACLE-L

Hi DBAs,

I have a query something like

SELECT sysdate,'txt1','txt2'
FROM dual
UNION
SELECT date1,txtfield1,txtfield2
FROM t1,t2,...,tn
WHERE
....... ;

The output would be one header record from the first select then the data from the second select.
If there are no records selected in second select the header record is still selected. If there are no
records in second select I do not want header record selected. How can I suppress it? I do not want to apply the where clause in 2nd select to the first because of the complexity.

Thanks
Rick

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: Rick_Cale_at_teamhealth.com

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).

------_=_NextPart_001_01C25A9F.76CECF00
Content-Type: text/html;
 charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2654.19">
<TITLE>RE: SQL help</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Not tested .... but </FONT> </P>

<P><FONT SIZE=2>select sysdate, 'test1','test2'</FONT>
<BR><FONT SIZE=2>from dual</FONT>
<BR><FONT SIZE=2>where exists ( your union clause)</FONT>
<BR><FONT SIZE=2>union</FONT>
<BR><FONT SIZE=2>your_union_clause</FONT>
</P>
<BR>

<P><FONT SIZE=2>Raj</FONT>
<BR><FONT SIZE=2>______________________________________________________</FONT>
<BR><FONT SIZE=2>Rajendra Jamadagni&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MIS, ESPN Inc.</FONT>
<BR><FONT SIZE=2>Rajendra dot Jamadagni at ESPN dot com</FONT>
<BR><FONT SIZE=2>Any opinion expressed here is personal and doesn't reflect that of ESPN Inc. </FONT>
<BR><FONT SIZE=2>QOTD: Any clod can have facts, but having an opinion is an art!</FONT>
</P>
<BR>
<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Rick_Cale_at_teamhealth.com [<A HREF="mailto:Rick_Cale_at_teamhealth.com">mailto:Rick_Cale_at_teamhealth.com</A>]</FONT>
<BR><FONT SIZE=2>Sent: Thursday, September 12, 2002 5:48 PM</FONT>
<BR><FONT SIZE=2>To: Multiple recipients of list ORACLE-L</FONT>
<BR><FONT SIZE=2>Subject: SQL help</FONT>
</P>
<BR>

<P><FONT SIZE=2>Hi DBAs,</FONT>
</P>

<P><FONT SIZE=2>I have a query something like</FONT> </P>

<P><FONT SIZE=2>SELECT sysdate,'txt1','txt2'</FONT>
<BR><FONT SIZE=2>FROM dual</FONT>
<BR><FONT SIZE=2>UNION</FONT>
<BR><FONT SIZE=2>SELECT date1,txtfield1,txtfield2</FONT>
<BR><FONT SIZE=2>FROM t1,t2,...,tn</FONT>
<BR><FONT SIZE=2>WHERE</FONT>
<BR><FONT SIZE=2>....... ;</FONT>
</P>

<P><FONT SIZE=2>The output would be one header record from the first select then the data</FONT>
<BR><FONT SIZE=2>from the second select.</FONT>
<BR><FONT SIZE=2>If there are no records selected in second select the header record is</FONT>
<BR><FONT SIZE=2>still selected.&nbsp; If there are no</FONT>
<BR><FONT SIZE=2>records in second select I do not want header record selected.&nbsp; How can I</FONT>
<BR><FONT SIZE=2>suppress it? I do not want to apply the where</FONT>
<BR><FONT SIZE=2>clause in 2nd select to the first because of the complexity.</FONT> </P>
<P><FONT SIZE=2>Thanks</FONT>
<BR><FONT SIZE=2>Rick</FONT>
</P>
<BR>

<P><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Please see the official ORACLE-L FAQ: http://www.orafaq.com</FONT>
<BR><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Author: </FONT>

<BR><FONT SIZE=2>&nbsp; INET: Rick_Cale_at_teamhealth.com</FONT> </P>
<P><FONT SIZE=2>Fat City Network Services&nbsp;&nbsp;&nbsp; -- (858) 538-5051&nbsp; FAX: (858) 538-5051</FONT>
<BR><FONT SIZE=2>San Diego, California&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Public Internet access / Mailing Lists</FONT>
<BR><FONT SIZE=2>--------------------------------------------------------------------</FONT>
<BR><FONT SIZE=2>To REMOVE yourself from this mailing list, send an E-Mail message</FONT>
<BR><FONT SIZE=2>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in</FONT>
<BR><FONT SIZE=2>the message BODY, include a line containing: UNSUB ORACLE-L</FONT>
<BR><FONT SIZE=2>(or the name of mailing list you want to be removed from).&nbsp; You may</FONT>
<BR><FONT SIZE=2>also send the HELP command for other information (like subscribing).</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C25A9F.76CECF00--

------=_NextPartTM-000-f143edc8-0d5e-4a4e-b8f8-6337e47d8e4b Content-Type: text/plain;
 name="ESPN_Disclaimer.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="ESPN_Disclaimer.txt"

*********************************************************************This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 and delete this e-mail message from your computer, Thank you.*********************************************************************1

------=_NextPartTM-000-f143edc8-0d5e-4a4e-b8f8-6337e47d8e4b--

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Jamadagni, Rajendra
  INET: Rajendra.Jamadagni_at_espn.com

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). Received on Thu Sep 12 2002 - 17:03:23 CDT

Original text of this message

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