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

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

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

From: Jens Mayer <jmayer_at_ratundtat.com>
Date: Thu, 06 May 1999 16:04:17 +0200
Message-ID: <3731A161.29C3D753@ratundtat.com>


Hi Vickie,

try the DECODE-Function:

Decode(lf_rows,0,0,del_lf_rows/lf_rows)

means: if lf_rows = 0 then result is 0

       else result is del_lf_rows/lf_rows

Jens

Vickie Jones schrieb:
>
> 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 Thu May 06 1999 - 09:04:17 CDT

Original text of this message

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