I have a script in which i connect to database to run a query and get the result of the query to a temp file. This works fine , now what i want is there is flat file which contains the value to be used in the query. I want to read this file line by line and then run the query for each value in that file.
Example
Lets say Flat file(abc.txt) contains employee number
713
845
81
I need to run this query within a script
select * from emptab where emp_no="value from the file"
The present script runs fine if i pass value like this
eusql<< EOF
select * from emptab where emp_no in ('713','845','81')
go > tmp.txt
EOF
But i cant edit the code always so i would like to have this edited within a flat file and use the same in the script.
I tried with this but it didn't work
While read val
do
eusql<< EOF
select * from emptab where emp_no="$val"
go > tmp.txt
EOF
done < abc.txt
Thanks in advance.