15.00 - Guidelines for Using the CURRENT_TIME and CURRENT_TIMESTAMP Functions in an SQL Procedure - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1184-015K
Language
English (United States)

Guidelines for Using the CURRENT_TIME and CURRENT_TIMESTAMP Functions in an SQL Procedure

When you create a procedure that contains the CURRENT_TIME or CURRENT_TIMESTAMP functions, Teradata Database incorporates the value for the function at the time the procedure is compiled using the time or time zone value for the creator of the function based on the local session time zone settings of the DBS Control parameters SystemTimeZoneHour and SystemTimeZoneMinute.

If you adjust the settings of these parameters to make a time zone adjustment, any procedure created with the intent of returning a current value for the CURRENT_TIME or CURRENT_TIMESTAMP functions that is adjusted for the local time no matter where the procedure is invoked will not return the intended result.

You could recompile the procedure periodically, but that is not a universally applicable solution to the problem.

The best practice is to insert an appropriate time zone string into the tdlocaledef file for your site. That way, Teradata Database automatically makes the necessary time zone changes, ensuring that the CURRENT_TIME and CURRENT_TIMESTAMP functions within the procedure always return an appropriate value.

See “Time Zone Strings” on page 891 for a complete list of valid time zone strings.