16.10 - Example – Job with Single APPLY Statement - Parallel Transporter

Teradata Parallel Transporter Reference

Product
Parallel Transporter
Release Number
16.10
Published
July 2017
Content Type
Programming Reference
Publication ID
B035-2436-077K
Language
English (United States)

The following example shows a job with a single APPLY statement without using the job step syntax:

DEFINE JOB LOADPROD
DESCRIPTION 'LOAD PRODUCT DEFINITION TABLE'
(
   DEFINE SCHEMA PRODUCT_SOURCE_SCHEMA
   DESCRIPTION 'PRODUCT INFORMATION'
   (
      PRODUCT_NAME        VARCHAR(24),
      PRODUCT_CODE        INTEGER,
      PRODUCT_DESCRIPTION VARCHAR(512),
      PRODUCT_COST        INTEGER,
      PRODUCT_PRICE       INTEGER
   );

   DEFINE OPERATOR LOAD_OPERATOR
   DESCRIPTION 'TERADATA PARALLEL TRANSPORTER LOAD OPERATOR'
   TYPE LOAD
   SCHEMA *
   ATTRIBUTES
   (
      INTEGER TenacityHours   = 0,
      INTEGER TenacitySleep   = 0,
      INTEGER BufferSize      = 16,
      INTEGER MaxSessions     = 1,
      INTEGER MinSessions     = 1,
      INTEGER ErrorLimit      = 1,
      VARCHAR TdpId           = 'MYDATABASE',
      VARCHAR UserName        = 'MYUSER',
      VARCHAR UserPassword    = 'MYPASSWORD',
      VARCHAR AccountId       = 'MYACCT',
      VARCHAR WorkingDatabase = 'SALES',
      VARCHAR TargetTable     = 'SALES_TABLE',
      VARCHAR LogTable        = 'SALES.SALES_TABLE_LOG',
      VARCHAR ErrorTable1     = 'SALES.SALES_TABLE_ERROR1',
      VARCHAR ErrorTable2     = 'SALES.SALES_TABLE_ERROR2'
   );

   DEFINE OPERATOR DATACONN
   DESCRIPTION 'TERADATA PARALLEL TRANSPORTER DATACONNECTOR OPERATOR'
   TYPE DATACONNECTOR PRODUCER
   SCHEMA PRODUCT_SOURCE_SCHEMA
   ATTRIBUTES
   (
      VARCHAR FileName      = 'sales_data.txt',
      VARCHAR OpenMode      = 'Read',
      VARCHAR Format        = 'FORMATTED',
      VARCHAR IndicatorMode
   );

   APPLY ('INSERT INTO SALES_TABLE (:PRODUCT_NAME,
                                    :PRODUCT_CODE,
                                    :PRODUCT_DESCRIPTION,
                                    :PRODUCT_COST,
                                    :PRODUCT_PRICE);')
   TO OPERATOR (LOAD_OPERATOR [3])

   SELECT * FROM (OPERATOR DATACONN);
);