Script with the variable CURR_DATE

Training
Fan

Script with the variable CURR_DATE

I am new to TeraData and Data Warehouses.

I have a stored procedure that utilizes the following code:

SELECT
CALENDAR_DATE AS Reporting_Date,
CAST('LD' AS VARCHAR(10)) AS Report_Period_Cd,
CAST('Latest Date' AS VARCHAR(20)) AS Reporting_Period_Desc
FROM
SYS_CALENDAR.CALENDAR
INNER JOIN Reporting_DB.V_REPORT_DATE ON CALENDAR_DATE = CURR_DATE

Nowhere in the procedure is CURR_DATE set as a variable, so I thought maybe it is part of ANSI SQL, like CURRENT_DATE, or is some sort of parameter in TeraData.  But this does not seem to be the case.

When I perform the following queries I get the following results:

SELECT CURRENT_DATE;

-- Result: '7/1/2016'

SELECT CURR_DATE;

-- Result: 'Error 3822: Cannot resolve column 'CURR_DATE'

SELECT
CALENDAR_DATE AS Reporting_Date,
CAST('LD' AS VARCHAR(10)) AS Report_Period_Cd,
CAST('Latest Date' AS VARCHAR(20)) AS Reporting_Period_Desc
FROM
SYS_CALENDAR.CALENDAR
INNER JOIN Reporting_DB.V_REPORT_DATE ON CALENDAR_DATE = CURR_DATE;

-- Result: Reporting_Date | Report_Period_Cd | Reporting_Period_Desc
'6/30/2016' | 'LD' | 'Latest Date'

I don't understand how within a query as a condition, CURR_DATE is recognized and used, but when I try SELECT CURR_DATE; alone it is not recognized the same as CURRENT_DATE.  Does anyone know the answer to this?  Somehow, CURR_DATE relates to yesterday's date, but I am not sure where this association is being made, or why it works in a query, but not when I try to SELECT it on its own.

Thanks,

Eric


1 REPLY
Teradata Employee

Re: Script with the variable CURR_DATE

CURR_DATE appears to be a column in your Reporting_DB.V_REPORT_DATE view.