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: Order of where clause matters!

Re: Order of where clause matters!

From: Patrick Joyal <please.reply_at_to.the.newsgroup>
Date: 2000/05/26
Message-ID: <392edaa6@news>#1/1

You won't get the error, but you would get rows where col_a = 0 but you don't want them.

two safe ways to do it:

Select * from my_table
  where decode (col_a, 0, 0, col_b / col_a) > 10 ;

or

(maybe slower 'cause it uses a subquery)

select *
  from
    (

     Select * from my_table
     where col_a <> 0

    )
 Where col_b /col_a > 10 ;

>
>A workaround could be:
>
>select *
>from my_table
>where stuff /* stuff that means "col_a" is never 0 */
>and col_b/decode(col_a, 0, 1, col_a) > 10;
>
>So you won't get the error.
>
>Wei
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Fri May 26 2000 - 00:00:00 CDT

Original text of this message

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