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: MINUS--Sql help

Re: MINUS--Sql help

From: Yosi Greenfield <yosi_at_comhill.com>
Date: Thu, 12 Jul 2001 20:35:37 -0700
Message-ID: <F001.0034972A.20010712204019@fatcity.com>

Rivandra,

The minus operator is a set operator. It subtracts one result set from another. That is, the rows from the second result set that exist in the first result set are removed from the first result set, and the remaining rows are returned.

To substract one sql numeric result from another, use sqlplus variables.

col a new_value a_hold
select 15 a from dual;

select 25 - &a_hold from dual;

will provide the desired result.

hth,

Yosi

Ravindra Basavaraja wrote:

> I am writing a SQL query using the MINUS operator.Both the select statements
> return a number result and I
> am trying to get the o/p with the difference of both the queries using the
> MINUS
> between the two select statements.But I am getting the o/p of the first
> query only
> and the displayed result is not the subtracted value.Both select statements
> give
> different number o/p when run individually.What could be wrong.
>
> Is there anything that i am missing to consider when using the MINUS
> operator.
>
> Pls help
>
> Thanks
> Ravindra
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Ravindra Basavaraja
> INET: ravindra_at_sentica.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).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Yosi Greenfield
  INET: yosi_at_comhill.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 Jul 12 2001 - 22:35:37 CDT

Original text of this message

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