Re: SQL Statement

From: Scott Borth <borths_at_my-deja.com>
Date: Tue, 20 Jul 1999 23:16:03 GMT
Message-ID: <7n2vv8$bgh$1_at_nnrp1.deja.com>


The zero? is the first value to decode within the SQL statement. When the mod function generates a value, it checks whether the value is '0', and returns the value of rownum. Otherwise it will return the value of NULL. Look at it this way:

if mod(rownum,5) = 0, then return rownum   else return null.
(It will return only those rownum values which are a multiple of 5.

Scott

In article <97712538_at_NEWS.SAIC.COM>,
  "Tay, Virginia" <htay_at_geocities.com> wrote:
> Hi,
>
> Can someone explain the following SQL statement for
me...Especially.....the
> DECODE functon....Why do I need to put a 'O' right after MOD...???
>
> select title, doc_category, decode(mod(rownum,5),0,rownum,null)
> from fieldd0200
>
> Thanks in advance!!!
>
> Ben
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Wed Jul 21 1999 - 01:16:03 CEST

Original text of this message