Tpt脚本问题将Clob数据类型加载到teradata中

时间:2017-02-17 10:01:36

标签: teradata utilities

我正在编写我的第一个tpt脚本。我的要求是基本的。我想在exadata中加载一个表(其中包含clob和blob数据类型)到teradata中。 我发现几个帖子说我只能使用sql inserter操作符来加载clob和blob类型。我在下面找到了脚本:

SET TdpId=
SET UserName=
SET UserPassword=
DEFINE JOB LOADING_LOB_DATA
DESCRIPTION 'LOAD PRODUCT DEFINITION TABLE'
(

DEFINE SCHEMA SOURCE_SCHEMA
DESCRIPTION 'PRODUCT INFORMATION SCHEMA'
(
     COL1_ID VARCHAR(38),
     COL2_CLOB CLOB(50000) AS DEFERRED BY NAME,
     COL3_BLOB BLOB(100000) AS DEFERRED BY NAME
);

DEFINE OPERATOR DDL_OPERATOR()
DESCRIPTION 'DDL Operator'
TYPE DDL
ATTRIBUTES
(
    VARCHAR ARRAY ErrorList = ['3706','3803','3807'],
    VARCHAR DateForm,
    VARCHAR TraceLevel = ‘None’,
    VARCHAR PrivateLogName = 'ddllog',
    VARCHAR TdpId = @TdpId,
    VARCHAR UserName = @UserName,
    VARCHAR UserPassword = @UserPassword,
    VARCHAR AccountID,
    VARCHAR WorkingDatabase
);

DEFINE OPERATOR FILE_READER ()
DESCRIPTION 'DataConnector READER Operator'
TYPE DATACONNECTOR PRODUCER
SCHEMA SOURCE_SCHEMA
ATTRIBUTES
(
    VARCHAR TraceLevel = ‘None’,
    VARCHAR PrivateLogName = 'dtac_r_log',
    VARCHAR DirectoryPath = @SourceDirectoryPath,
    VARCHAR FileName = @SourceFileName,
    VARCHAR OpenMode = 'Read',
    VARCHAR IndicatorMode,
    VARCHAR Format = @SourceFileFormat
);

DEFINE OPERATOR SQL_INSERTER ()
DESCRIPTION 'TERADATA INSERTER UTILITY'
TYPE INSERTER 
INPUT SCHEMA *
ATTRIBUTES
(
    VARCHAR TraceLevel = 'None',
    VARCHAR PrivateLogName = 'ins_log',
    VARCHAR Tdpid = @TdpId,
    VARCHAR UserName = @UserName,
    VARCHAR UserPassword = @UserPassword
);

STEP CREATE_SOURCE_TABLE
(
    APPLY
    ('drop table ' || @SourceTable || ' ;'),
    ('create table ' || @SourceTable || ' , FALLBACK ,
     NO BEFORE JOURNAL,
     NO AFTER JOURNAL
   (
        col1_id VARCHAR(38),
        col2_clob clob(50000),
        col3_blob blob(100000)
    ) primary index (col1_id);')

   TO OPERATOR ( DDL_OPERATOR () );
);

STEP LOADING_DATA_TO_SOURCE_TABLE
(
    APPLY

     ('INSERT INTO ' || @SourceTable || ' values ( 
        :COL1_ID, :COL2_CLOB, :COL3_BLOB);')

   TO OPERATOR (SQL_INSERTER [1])

   SELECT * FROM OPERATOR (FILE_READER ());
);

);

有谁能告诉我file_reader()运算符和ddl_operator在这里的用途是什么?我不会首先要求ODBC_OPERATOR,然后是sql opertaor吗? 请帮帮我。

0 个答案:

没有答案