问题
As the topic, how do I manipulate the data from the flat file before loading them onto teradata database using BTEQ script.... I'm unsure which part should the manipulation be written onto the bteq script....
USING
------------------------------------------------------
INSERT INTO
------------------------------------------------------
Values
In my opinion, data manipulation should be done here
------------------------------------------------------
Table Name : Jerry
A
-------
| 5 |
| 6 |
| 7 |
-------
Values in the data file,
00005|Jim
0 |Apple
|Loop
Condition:
The data is read from the data file. The row whose first column is 0 or NULL should not be loaded, also the leading 0 should be executed before loading into the table........
Guess:
VALUES
(
IF TRIM(LEADING '0' FROM :A) != NULL OR IF TRIM(LEADING '0' FROM :A) != 0
THEN TRIM(LEADING '0' FROM :A)
,B
,C
);
回答1:
Please don't bteq for loading. This was never the intention of this tool.
For conditional Loading, you can put criteria in MLoad in the APPLY Statement. Same to the current tool for loading, TPT. In TPT it's "INSERT INTO SELECT from where ". In addition you can mix Load (Load or Update -Operator) & DML (DDL Operator) in one TPT -script.
来源:https://stackoverflow.com/questions/60540302/how-do-i-check-and-manipulate-the-data-from-a-flat-before-loading-them-to-terada