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: SQL Statement

Re: SQL Statement

From: Scott Borth <borths_at_my-deja.com>
Date: Tue, 20 Jul 1999 23:12:35 GMT
Message-ID: <7n2vop$bdm$1@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 Tue Jul 20 1999 - 18:12:35 CDT

Original text of this message

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