Oracle interval data type

Source: Internet
Author: User

Oracle Syntax:
INTERVAL '{integer | integer time_expr | time_expr }'
{DAY | HOUR | MINUTE} [(leading_precision)]
| SECOND [(leading_precision [, fractional_seconds_precision])]}
[TO {DAY | HOUR | MINUTE | SECOND [(fractional_seconds_precision)]}]

The leading_precision value ranges from 0 to 9. The default value is 2. the format of time_expr is HH [: MI [: SS [. n] or MI [: SS [. n] or SS [. n], n indicates microseconds.
This type is similar to interval year to month. We recommend that you read interval year to month first.

Range value:
HOUR: 0 to 23
MINUTE: 0 to 59
SECOND: 0 to 59.999999999

Eg:
INTERVAL '4 5:12:10. 222 'Day to second (3)
Indicates 4 days, 5 hours, 12 minutes, and 10.222 seconds.

INTERVAL '4:12 'DAY TO MINUTE
Indicates 4 days, 5 hours, and 12 minutes.

INTERVAL '0000005' DAY (3) TO HOUR
The value is 5 hours in 400 days, and 3 in 400 is the precision. Therefore, "DAY (3)". Note that the default value is 2.

INTERVAL '000000' DAY (3)
400 days

INTERVAL '11: 12: 10.2222222 'hour to second (7)
Indicates 11 hours, 12 minutes, 10.2222222 seconds.

INTERVAL '11: 20' HOUR TO MINUTE
Indicates 11 hours and 20 minutes.

INTERVAL '10' HOUR
10 hours

INTERVAL '10: 22' MINUTE TO SECOND
Indicates 10 minutes and 22 seconds.

INTERVAL '10' MINUTE
Meaning: 10 points

INTERVAL '4' DAY
Indicates four days.

INTERVAL '25' HOUR
Representation: 25 hours

INTERVAL '40' MINUTE
Indicates: 40 points

INTERVAL '000000' HOUR (3)
120 hours

INTERVAL '30. 100' SECOND (12345)
30.1235 seconds, because the precision after the second is set to 4, rounding is required.

INTERVAL '20' DAY-INTERVAL '000000' HOUR = INTERVAL '10-0' DAY TO SECOND
Indicates 20 days-240 hours = 10 days, 0 seconds

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.