Hi,
I am using TPT to load a '|' delimited file. However, the blank space coming between 2 delimiters should be loaded as null in the target char field. I tried to achive this using CASE WHEN as mentioned in manual, but that ended up with following syntax error. Please help!
Teradata Parallel Transporter Version 14.00.00.04
TPT_INFRA: Syntax error at or near line 58 of Job Script File 'tpt_load1.tpt
TPT_INFRA: At "SELECT" missing SEMICOL_ in Rule: STEP
Compilation failed due to errors. Execution Plan was not generated.
Job script compilation failed.
Job terminated with status 8.
The sample file looks like this,
1362549| |0000000013625493|1993-03-22|
1362486|SV|0000000013624863|1989-07-13|
1362489| |4561143213624894|1990-08-16|1995-09-18
Here is the script:
DEFINE JOB Load_accts
DESCRIPTION 'Load a Teradata table from a file' (
DEFINE SCHEMA Schema_accts (
cust_id VARCHAR
,acct_type VARCHAR
,acct_nbr VARCHAR
,acct_start_date VARCHAR
,acct_end_date VARCHAR
);
DEFINE OPERATOR DataConnector_accts
TYPE DATACONNECTOR PRODUCER
SCHEMA Schema_accts
ATTRIBUTES (
VARCHAR PrivateLogName = 'tduser.accts',
VARCHAR FileName = 'accts1.txt',
VARCHAR TraceLevel = 'All',
VARCHAR FORMAT = 'Delimited',
VARCHAR TextDelimiter = '|',
VARCHAR OpenMode = 'read'
);
DEFINE OPERATOR Insert_accts
TYPE INSERTER
SCHEMA *
ATTRIBUTES (
VARCHAR PrivateLogName = 'tduser.accts',
VARCHAR TdpId = @TargetTdpId,
VARCHAR UserName = @TargetUserName,
VARCHAR UserPassword = @TargetUserPassword,
VARCHAR TargetTable = 'tduser.accts',
VARCHAR LogTable = 'tduser.accts_L',
VARCHAR ErrorTable1 = 'tduser.accts_E1',
VARCHAR ErrorTable2 = 'tduser.accts_E2',
VARCHAR WorkTable = 'tduser.accts_WT'
);
STEP Load_accts (
APPLY (
'INSERT INTO tduser.accts (
cust_id
,acct_type
,acct_nbr
,acct_start_date
,acct_end_date
)
VALUES (
:cust_id
,:acct_type
,:acct_nbr
,:acct_start_date
,:acct_end_date
);'
)
TO OPERATOR (
Insert_accts[1]
)
SELECT
cust_id
,CASE WHEN TRIM(acct_type)='' THEN
NULL
ELSE
acct_type
END AS acct_type
,acct_nbr
,acct_start_date
,acct_end_date
FROM OPERATOR (
DataConnector_accts[1]
);
);
);
↧