Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: simple SQL question about dividing numbers

Re: simple SQL question about dividing numbers

From: Alex Hepp <heppa_at_web.de>
Date: Thu, 21 Feb 2002 14:57:39 +0100
Message-ID: <3c74fcd4@news.gwi-ag.com>


Hi. You have been on the right track there. In your matter, Trunc(16/5) and floor(16/5) do exactly the same. But trunc is a little more flexible. floor returns the largest integer less or equal then the given value whereas trunc can be changed so that you can tell it how many decimal characters.

Example:

SQL> select trunc(16/5,1) from dual;

TRUNC(16/5,1)


          3,2

if you omitt the second parameter, 0 is taken, and that means no decimal character.

Alex
  Julian Kooiker <julian.kooiker_at_quicknet.nl> schrieb in im Newsbeitrag: C7nc8.90482$yS6.7051251_at_amsnews02.chello.com...   thank you. Do you know what the function 'floor' does? It looks like the same as trunc then.     "DStevens" <dstevens_at_navidec.com> schreef in bericht news:a4s0f6$otv$1_at_newsreader.mailgate.org...     Trunc
    select 16/5, trunc(16/5) from dual;

          16/5 TRUNC(16/5)

    Elapsed: 00:00:00.01
    SQL>            Julian Kooiker wrote:

      Hi, 
      I have a little problem and I can't find it in the documentation of sql. (I 
      have a small learning book). 
      If I divide a number, for example 16 / 5 then I want to grab only the number 
      before the comma. Which function do I need to use? 

      Julian Kooiker
Received on Thu Feb 21 2002 - 07:57:39 CST

Original text of this message

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