Datasheet

SQL Fundamentals
19
Value Datatype Stored Value Explanation
0.09999 NUMBER(4,5) 0.09999 Stored as it is; only four digits after the
decimal point and zero.
0.099996 NUMBER(4,5) Error Rounding this value to four digits after
the decimal and zero results in 0.1, which
is outside the range.
DATE
The DATE datatype is used to store date and time information. This datatype can be con-
verted to other forms for viewing, but it has a number of special functions and properties
that make date manipulation and calculations simple. The time component of the DATE
datatype has a resolution of one secondno less. The DATE datatype occupies a storage
space of 7 bytes. The following information is contained within each DATE datatype:
Century
Year
Month
Day
Hour
Minute
Second
Date values are inserted or updated in the database by converting either a numeric value
or a character value into a DATE datatype using the function
TO_DATE. Oracle defaults the
format to display the date as
DD-MON-YY. This format shows that the default date must begin
with a two-digit day, followed by a three-character abbreviation for the month, followed
by a two-digit year. If you specify the date without including a time component, the time is
defaulted to midnight, or 00:00:00 in military time. The
SYSDATE function returns the cur-
rent system date and time from the database server to which you’re currently connected.
TIMESTAMP [<precision>]
The TIMESTAMP datatype stores date and time information with fractional precision for
seconds. The only difference between the DATE and TIMESTAMP datatypes is the ability
to store fractional seconds up to a precision of nine digits. The default precision is 6 and
can range from 0 to 9. Similar to the
SYSDATE function, the SYSTIMESTAMP function returns
the current system date and time, with fractional precision for seconds.
TABLE 1.3 Precision and Scale Examples (continued)
95127c01.indd 19 2/18/09 6:37:08 AM