Re: Comparison in SQL

Elango Velayutham <[email protected]> Wed, 5 Mar 2003 08:19:44 +0400
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-898348-2003.03.05-04.18.06--gcdod-oracle#[email protected]>
for clarity purpose you can also use case function in sql...

scmown@DEV8>var x number
scmown@DEV8>exec :x := 35;
  1* select (case when :x < 35 then 1 else 2 end) result from dual
scmown@DEV8>/

    RESULT
----------
         2

HTH
Elango 




-----Original Message-----
From: Chris Sol [mailto:[email protected]]
Sent: 03 March 2003 18:43
To: Oracle
Subject: [oracle] Re: Comparison in SQL


Thank

Your solution works very well

CHRIS

> -----Original Message-----
> From:	[email protected] [SMTP:[email protected]]
> Sent:	03 March 2003 14:00
> To:	Oracle
> Subject:	[oracle] Re: Comparison in SQL
> 
> 
> if you're talking about in a select statement then
> 
> select decode(sign(a-b),-1,a,b) from ......
> 
> i may have things the wrong way around but you should get the drift
> 
> Regards
> Chris Farmer
> 
> 
> 
>  
> 
>                       Chris Sol
> 
>                       <[email protected]        To:       "Oracle"
> <[email protected]>               
>                       g.uk>                    cc:
> 
>                                                Subject:  [oracle]
> Comparison in SQL                   
>                       03/03/2003 13:56
> 
>                       Please respond to
> 
>                       "Oracle"
> 
>  
> 
>  
> 
> 
> 
> 
> 
> Hi
> 
> Anybody know what the best way to achieve the following
> 
> If field_ a > field_b then x= 'A' else x='B'
> 
> 
> Chris Sol
> Analyst Programmer
> IT Development
> Genesis Housing Group
> Telephone 02085374169
> 
> 
> **************************************************************************
> **
> 
> The Genesis Housing Group - Email Disclaimer
> --------------------------------------------
> The information in this email and any attachments is strictly
> confidential and may be legally privileged.
> It is intended solely for the use of the addressee(s) only. Access to
> this email by anyone else is unauthorised.  If you have received this
> email in error please notify the sender immediately by return email or
> telephone.  Please note that if you are not the intended recipient, you
> must not copy, distribute or otherwise act on any part of this email or
> it's attachments.
> Although we have taken precautions to ensure that this email and
> attachments are free from any virus, we would advise you that it is your
> responsibility to ensure that this is true when reading or actioning
> this email.
> 
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or
> to unsubscribe send a blank email to %%email.unsub%%.
> 
> 
> 
> 
> 
> 
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or 
> to unsubscribe send a blank email to %%email.unsub%%.
>  
****************************************************************************
The Genesis Housing Group - Email Disclaimer
--------------------------------------------
The information in this email and any attachments is strictly
confidential and may be legally privileged.
It is intended solely for the use of the addressee(s) only. Access to
this email by anyone else is unauthorised.  If you have received this
email in error please notify the sender immediately by return email or
telephone.  Please note that if you are not the intended recipient, you
must not copy, distribute or otherwise act on any part of this email or
it's attachments.
Although we have taken precautions to ensure that this email and
attachments are free from any virus, we would advise you that it is your
responsibility to ensure that this is true when reading or actioning
this email.

---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to %%email.unsub%%.


---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to [email protected].