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: Misbehaving query

Re: Misbehaving query

From: Vladimir Begun <Vladimir.Begun_at_oracle.com>
Date: Fri, 12 Dec 2003 12:59:34 -0800
Message-ID: <F001.005D9B4D.20031212125934@fatcity.com>


Bellow, Bambi wrote:
> SQL> select a.*, b.*
> 2 from
> 3 ( select * from junk minus select * from junk2 ) a,
> 4 ( select * from junk2 minus select * from junk ) b;
>
> no rows selected

SELECT a.*

      , b.*
   FROM (SELECT dummy x FROM dual WHERE 1 = 2) a

      , (SELECT dummy x FROM dual) b
  WHERE b.x = a.x(+)
/

SELECT a.*

      , b.*
   FROM (SELECT dummy x FROM dual WHERE 1 = 2) a

      , (SELECT dummy x FROM dual) b
/

You join empty result set of table a, with some rows from table b.

-- 
Vladimir Begun
The statements and opinions expressed here are my own and
do not necessarily represent those of Oracle Corporation.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Vladimir Begun
  INET: Vladimir.Begun_at_oracle.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 Fri Dec 12 2003 - 14:59:34 CST

Original text of this message

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