Export column value from teradata as separate .txt files

428 views Asked by At

im trying to write a code to export data present in column "task detail", and its export file name should be the same rows " task name " value

eg:

Task Detail task name

task detail1 task name1 task detail2 task name2

the task details 1 ans 2 should be exported into separate txt files with task name 1 and 2 as the file names respectively

I tried exporting the task name values into a separate txt file first called input_filename.txt , then loop through it line by line, assign the line value to a variable and if the variable and task name value matches, export the task details with variable name

code:

.LOGON 


while read -r line ; do

File_name=$(echo $line);


.Export data file=${PATH1}/${File_name}.txt, close


SELECT  Tasks.Task_SQL
FROM {DBAAAS}.Tasks AS Tasks
WHERE Tasks.Task_Name=${File_name};
.EXPORT RESET

done <${PATHH}/input_filename.txt

.LOGOFF;
.QUIT;

Im facing 2 errors,

  1. expect something between start of request and while enter code hereKeyword 2)Failure 3704 '{' ('7B'X) is not a valid Teradata SQL token.

Can someone please help me with what im doing wrong?

0

There are 0 answers