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: Simple rounding query

Re: Simple rounding query

From: Alex Filonov <afilonov_at_yahoo.com>
Date: 16 Jun 2004 14:41:25 -0700
Message-ID: <336da121.0406160829.688b1d42@posting.google.com>


Jeremy <newspostings_at_hazelweb.co.uk> wrote in message news:<MPG.1b3a10a5f005d4cb989c66_at_news.individual.net>...
> Perhaps I'm being a bit thick here, but is there a single function call
> I can make in pl/sql (8.1.7.x) which wil round up to the next integer?
>
> I want:
> 29/10 = 3
> 30/10 = 3
> 31/10 = 4
>
> ?

Use ceil function:

  1* select ceil(30/10) from dual
SQL> / CEIL(30/10)


          3

  1* select ceil(31/10) from dual
SQL> / CEIL(31/10)


          4

Note: For negative integers, ceil takes greater (i.e. smaller by absolute value) integer:

  1* select ceil(-31/10) from dual
SQL> / CEIL(-31/10)


          -3 Received on Wed Jun 16 2004 - 16:41:25 CDT

Original text of this message

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