Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Statement
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
![]() |
![]() |