10. 12. 1. Use timestamps |
|
Timestamps store a specific date and time. |
A timestamp stores the century, all four digits of a year, the month, the day, the hour (in 24-hour format), the minute, and the second. |
The timestamp can store a fractional second, DATE cannot. |
Timestamp can store a time zone. |
A timestamp stores |
- the century,
- all four digits of a year,
- the month,
- the day,
- the hour (in 24-hour format),
- the minute, and
- the second.
|
The advantages of a timestamp over a DATE are |
- A timestamp can store a fractional second.
- A timestamp can store a time zone.
|
There are three timestamp types |
TIMESTAMP[(seconds_precision)] Stores the |
- century,
- all four digits of a year,
- the month,
- the day,
- the hour (in 24-hour format),
- the minute, and
- the second.
|
You can specify an optional precision for the seconds by supplying seconds_precision |
The seconds_precision can be an integer from 0 to 9. |
The default is 6; which means you can store up to 6 digits to the right of the decimal point for your second. |
If you try to add a row with more digits in your fractional second than your TIMESTAMP can store, your fraction is rounded. |
- TIMESTAMP[(seconds_precision)] WITH TIME ZONE Extends TIMESTAMP to store a time zone.
- TIMESTAMP[(seconds_precision)] WITH LOCAL TIME ZONE Extends TIMESTAMP to convert a supplied datetime to the local time zone set for the database. The process of conversion is known as normalizing the datetime.
|
Quote from: |
Oracle Database 10g SQL (Osborne ORACLE Press Series) (Paperback) |
# Paperback: 608 pages |
# Publisher: McGraw-Hill Osborne Media; 1st edition (February 20, 2004) |
# Language: English |
# ISBN-10: 0072229810 |
# ISBN-13: 978-0072229813 |