17.05 - Writing the tpt Script - Teradata Database

Teradata Vantage™ - Advanced SQL Engine Analytic Functions

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
17.05
created_date
June 2020
category
Programming Reference
featnum
B035-1206-170K
  • Write the tpt script by substituting values for variables in the following script:
    DEFINE JOB PRODUCT_SOURCE_LOAD
    
    DESCRIPTION 'LOAD PRODUCT DEFINITION TABLE'
      (
        DEFINE SCHEMA PRODUCT_SOURCE_SCHEMA
        DESCRIPTION 'PRODUCT INFORMATION SCHEMA'
          (
            TD_compatible_table_definition
    
          STEP STEP_CREATE_DDL
          (
            APPLY
            ('DROP TABLE '||@TargetTable||' ;'),
            ('CREATE MULTISET TABLE '||@TargetTable||'(TD_compatible_table_definition;')
          TO OPERATOR ($DDL() [1]);
      );
      Step Insert_Tables
      (
        APPLY
        ('Ins '||@TargetTable||'(
          :"column_name_1"
          ,:"column_name_2"
          [...,:"column_name_k"]
        );
      )
      TO OPERATOR ($LOAD()[1])
    
      SELECT * FROM OPERATOR ($ODBC(PRODUCT_SOURCE_SCHEMA)[1]);
      );
    );