Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: "IF" equivilent in SQL select?????

Re: "IF" equivilent in SQL select?????

From: Prabhakar Narayanan <prabhakar.narayanan_at_clsasia.com>
Date: Fri, 07 May 1999 15:54:10 +0800
Message-ID: <37329C21.59F15A12@clsasia.com>


Hi

Try decode

SELECT decode(col1,1,1,2)
from dual

This means, if col1 = 1, then return the value 1 or return the value 2

Regards

N.Prabhakar

Vickie Jones wrote:

> Is there a function(?) that would be the equivilent to an "IF" statment that
> can be used in a select statment? Below is a sample of what I am trying to
> do and the results:
>
> analyze index ccdbp.ALARMS_CODES_KEY validate structure;
> col key_name format A50
> select 'ALARMS_CODES_KEY' as key_name,del_lf_rows/lf_rows "Ratio" from
> index_stats;
>
> ERROR:
> ORA-01476: divisor is equal to zero
>
> What I need is an "if" statement that says if lf_rows is 0 (zero) set
> 'del_lf_rows/lf_rows' to 0 (zero). I want to eliminate this error when I
> analyze my indexes.
>
> Thanks in advance!
> Vickie Jones
> Republic Engineered Steels, Inc.
> Canton, OH


Received on Fri May 07 1999 - 02:54:10 CDT

Original text of this message

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