0
votes

I have a generic file .spool with some tasks that I need to make over many tables using sqlplus. On the other hand, I have a txt file in which I have the names of the tables.

I'm trying to create a script that read the name of the tables and execute the task of the spool file over every table.

But it didn't work and it doesn't show me any error. Read the tables perfectly from the file and I take them out on the screen but it seems that the variable doesn't work well with the sqlplus command and does not create the final files.

But the script works if instead of the variable I use the name of the table in the sqlplus statement.

Any help, please!

Path_Table="/home/input/Table.txt"

while read t; do
  echo "$t"
  sqlplus USER/PASS @/home/My_Tasks.spool null ADMIN $t My_Schema;
done < $Path_Table
I see nothing wrong at the bash level. I do not have sqlplus on my system, but it is probably there the problems lies (arguments management). FYI the ; is useless at the end of the sqlplus command, but it is not a problem either. - Nic3500
Consider to check table names for non-printing character in it. Replace echo "$t" with echo "$t" | cat -t - user0
Perhaps you need an @ sign. eg @"$t" - William Pursell