Oracle® TimesTen In-Memory Database SQL Reference Release 11.2.1 Part Number E13070-03 |
|
|
View PDF |
Returns date rounded to the unit specified by the format model fmt
. The value returned is of type DATE. If you do not specify fmt
, then date
is rounded to the nearest day.
SQL syntax
ROUND(date [,fmt])
Parameters
ROUND (date) has the parameters:
Parameter | Description |
---|---|
date |
The date that is rounded. Must resolve to a date value.
If you do not specify fmt, then date is rounded to the nearest day. |
[,fmt ] |
The format model rounding unit. Specify either a constant or a parameter for fmt. |
Description
Date can be of type DATE or TIMESTAMP. The data type returned is DATE.
Data types TT_DATE and TT_TIMESTAMP are not supported.
For the supported format models to use in fmt
, see "Format model for ROUND and TRUNC date functions".
Examples
Round date to the first day of the following year by specifying 'YEAR' as the format model:
Command> SELECT ROUND (DATE '2007-08-25','YEAR') FROM dual; < 2008-01-01 00:00:00 > 1 row found.
Omit fmt
. Specify date as type TIMESTAMP with a time of 13:00:00. Date is rounded to nearest day:
Command> SELECT ROUND (TIMESTAMP '2007-08-16 13:00:00') FROM dual; < 2007-08-17 00:00:00 > 1 row found.