Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: USAGE OF ROUND AND TRUNC FUNCTIONS
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