The "typical" SQL DBMS supports date, time and timestamp data types but interval (as a separate data type) is not common yet. The majority of SQL DBMSs can't handle time zones, can't handle fractional seconds and can't handle leap seconds. For example, the Oracle DATE data type is typically a timestamp (i.e.: it includes both a date portion and a time portion, despite the name) with no fractional seconds, formatted as DD-MON-YY (e.g.: 06-JAN-97). Valid dates fall into the range January 1 4712 B.C. to December 31 4712 A.D. Intervals are expressed only as integers, representing number of days. The Oracle SYSDATE function returns the current date and the current time.

ODBC has several datetime functions; most are replaceable with standard SQL. Here are the different names to expect.

StandardODBC
CURRENT_DATECURDATE
CURRENT_TIMECURTIME
CURRENT_TIMESTAMPNOW
EXTRACT(MONTH ...MONTH
(EXTRACT(MONTH...)/4QUARTER
EXTRACT(DAY ...DAYOFMONTH
not supportedDAYOFWEEK
not supportedDAYOFYEAR
EXTRACT(HOUR ...HOUR
EXTRACT(MINUTE ...MINUTE
EXTRACT(SECOND ...SECOND

Comments

Comments loading...