Friday 27 January 2012

What is difference between TIME and CURRENT_TIME?

  • First difference is that TIME is a teradata extension and CURRENT_TIME is a ANSi standard.

  • Second difference is that data type returned by the TIME function is a FLOAT.
However CURRENT_TIME or CURRENT_TIME(0) returns type TIME(0) WITH TIME ZONE.

  • The TIME function lacks intelligence.
Which means SELECT TIME + 40; would give an error if current time is 23:24:34 because 34+40 seconds would lead to 74 seconds which is not valid.


NOTE: This is not case with DATE and CURRENT_DATE.
Both of them return DATE datatype which has calendar intelligence.

No comments:

Post a Comment