17.10 - Guidelines for Using the CURRENT_TIME and CURRENT_TIMESTAMP Functions in an SQL Procedure - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Detailed Topics

Advanced SQL Engine
Teradata Database
Release Number
July 2021
English (United States)
Last Update

When you create a procedure that contains the CURRENT_TIME or CURRENT_TIMESTAMP functions, Vantage 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, Vantage 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 for a complete list of valid time zone strings.