Sysdate returns the current system date and time and its return type is of date. But shouldn't date type only contain information on date and not on time. Why is this acceptable?
CodePudding user response:
Looking back:
- Oracle version 2 was released in 1979.
- The American National Standards Institute adopted SQL as a standard in 1986.
- ISO 9075: "Information Technology Database Languages - SQL" was adopted in 1987.
- Oracle version 6 was released in 1988.
Therefore, Oracle's implementation of a DATE data type predates the ANSI standard and Oracle chose to keep their original implementation rather than to break the backwards compatibility of the database versions to implement the ANSI/ISO standard.
But shouldn't date type only contain information on date and not on time.
The ANSI/ISO standard is for a DATE to contain year, month and day components.
Oracle's implementation predates the ANSI/ISO standard and does not comply with it for historic reasons. It is a binary data type that consists of 7 bytes for century, year-of-century, month, day, hour, minute and second. It ALWAYS has those components.
CodePudding user response:
Because Oracle implemented it that way.
SYSDATE returns the current date and time set for the operating system on which the database resides. The datatype of the returned value is DATE, and the format returned depends on the value of the NLS_DATE_FORMAT initialization parameter
