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

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
jpx1556733107962.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™

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 for a complete list of valid time zone strings.