17.05 - Example: Null Expansion Period Producing a Null Expanded Value - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
vnq1596660420420.ditamap
dita:ditavalPath
hoy1596145193032.ditaval

This example shows how a null expansion period produces a null expanded value. In this example, the value for PERIOD(DATE) in column pd is null, so the expansion on pd, expd, is also null.

     CREATE SET TABLE DF2.t4, NO FALLBACK, NO BEFORE JOURNAL,
                              NO AFTER JOURNAL, CHECKSUM = DEFAULT (
       x  INTEGER NOT NULL,
       y  INTEGER NOT NULL,
       pd PERIOD(DATE))
     PRIMARY INDEX (x);

First show that column pd is null.

     SELECT *
     FROM t4;
      *** Query completed. One row found. 3 columns returned.
      *** Total elapsed time was 1 second.
      x            y           pd
     -----------  -----------  -----------------------------------------
              10           30  ?

Then show that the expansion on pd aliased as expd, is also null.

     SELECT x, expd
     FROM t4
     EXPAND ON pd AS expd;
      *** Query completed. One row found. 2 columns returned.
      *** Total elapsed time was 1 second.
               x  expd
     -----------  ------------------------------------------------
              10  ?