Team Fly |
Date is the next commonest type of data you'll find in an Oracle database after character and numeric data. The date data type consists of two principal elements: date and time. It's important to keep in mind that the date data type includes time when comparing two dates with each other for equality.
The default date format in many Oracle databases is DD-MON-YY, where DD represents the day, MON is the month and YY is the two-digit year. A date can be inserted into a table without specifying either the four-digit year or a value for the time element. Oracle will default the century to '20' for years '00–49' and '19' for years '50–99'. Without a specific time being specified during an insert, the time will default to midnight, which is represented as '00:00:00'.
As with the numeric and character data types, Oracle has provided many date functions to help with the manipulation of date data. If you were to routinely print customized letters to your best customers offering them a special deal that expires on the last day of the month, the last_day function could be used to automatically generate the expiration date for the offer. Table 2-6 shows the commonest date functions.
Team Fly |