17.10 - 例: 単一のAPPLY文によるジョブ - Parallel Transporter

Teradata® Parallel Transporterリファレンス

Product
Parallel Transporter
Release Number
17.10
Release Date
2021年10月
Content Type
プログラミング リファレンス
Publication ID
B035-2436-061K-JPN
Language
日本語 (日本)

次の例は、ジョブ ステップ構文を使用しない単一のAPPLY文によるジョブを示しています。

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);
);