15.10 DR - sql for the current hour

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
New Member

15.10 DR - sql for the current hour

This is not meant to exhaustive but can be used to warm you before upgrading. 

We have upgraded to 15.10 recently. We ran into DR 182490 to 15.10.02. It is fixed in 15.10.04 that is GSA on 12/19.

 

 

 Issue: : If you run the below sql for the current hour (for example currently is 12:31 PM so I put in 12 in the case statements), the case statement in the where clause clearly equates rpt_dt to current_date – 1  if the hour from current time equates to 12 (which it should if the sql is executed between 12:01 PM  through 12:59 PM). But in the actual output rpt_dt comes out populated with the value of current_date and not current_date - 1

 

SQL

SELECT

 

EXTRACT(HOUR FROM CURRENT_TIME) ,

 

 

rpt_dt ,

 

 

(

CASE

    WHEN

        EXTRACT(HOUR FROM CURRENT_TIME) = 12

    THEN

        CURRENT_DATE-1

    ELSE

        CURRENT_DATE

END

)

 

 

FROM EDW_AGGR.BI_CHNL_PREDICTO a11

 

 

WHERE

 

rpt_dt=

(

CASE

    WHEN

        EXTRACT(HOUR FROM CURRENT_TIME) = 12

    THEN

        CURRENT_DATE-1

    ELSE

        CURRENT_DATE

END

)