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: USAGE OF ROUND AND TRUNC FUNCTIONS

Re: USAGE OF ROUND AND TRUNC FUNCTIONS

From: its not me <it.is_at_not.me.com>
Date: Tue, 15 Feb 2005 10:11:49 +0000
Message-ID: <8ai311t5337l4eo4t26prmem4a8c5i4ode@4ax.com>


On 15 Feb 2005 01:12:23 -0800, arijitchatterjee123_at_yahoo.co.in (Arijit Chatterjee) wrote:

>Dear Sir,
>As per your instruction I run the queries and got these
>outpous.Here truct return the same year but round next.
>But my question was what is the usage of these two functions.
>Through this outputs still I am not clear.
>
>SQL> SELECT trunc (TO_DATE ('27-oct-05'),'YEAR')
> 2 "New Year" FROM DUAL;
>/c clsNew Year
>---------
>01-JAN-05
>
>SQL> SELECT round (TO_DATE ('27-oct-05'),'YEAR')
> 2 "New Year" FROM DUAL;
>/c clsNew Year
>---------
>01-JAN-06
>
>Regards
>Arijit Chatterjee

There are lots of uses for these functions in businesses.

2 examples:

TRUNC(DATE)
If I am storing prices for an item at a given date the key might be item_id, price_date

I wound ensure that when I am inserting the date price_date := trunc(sysdate).

ROUND(DATE)
Some countries have a financial year that ends 30-Jun to determine current financial year := ROUND(sysdate,'YEAR') Received on Tue Feb 15 2005 - 04:11:49 CST

Original text of this message

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