Skip to content
Advertisement

Why is the return type of sysdate DATE? [closed]

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?

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement