文档地址:http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements003.htm#SQLRF00221
IntervalLiterals
An interval literal specifies a period of time. You can specifythese differences in terms of years and months, or in terms ofdays, hours, minutes, and seconds. Oracle Database supports twotypes of interval literals,YEAR
TO
MONTH
and DAY
TO
SECOND
. Each type contains a leading field and maycontain a trailing field. The leading field defines the basic unitof date or time being measured. The trailing field defines thesmallest increment of the basic unit being considered. For example,aYEAR
TO
MONTH
intervalconsiders an interval of years to the nearest month. ADAY
TO
MINUTE
intervalconsiders an interval of days to the nearest minute.
If you have date data in numeric form, then you can use theNUMTOYMINTERVAL
orNUMTODSINTERVAL
conversion function to convert the numeric data into intervalvalues.
Interval literals are used primarily with analyticfunctions.
INTERVAL YEAR TO MONTH
Specify YEAR
TO
MONTH
interval literals using the following syntax:
interval_year_to_month::=