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: integer division

Re: integer division

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1997/07/01
Message-ID: <33b856ff.32271083@newshost>#1/1

On 30 Jun 1997 15:38:47 -0700, dalee_at_pelican.cs.ucla.edu (Daren Lee) wrote:

>hi
>
>does anyone know how to force integer division?
>
>i'm subtracting 2 DATE types to get the number of
>days between them and then i need to divide by 7.
>
>e.g:
>
>to_char(date1,'j')-to_char(date2,'j')/7
>
>thanks
>

trunc(date1-date2)/7

will do it. subtracting 2 dates gives you the number of days between. trunc it to get the whole number of days.

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD

http://govt.us.oracle.com/ -- downloadable utilities



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Tue Jul 01 1997 - 00:00:00 CDT

Original text of this message

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