Pass variable to sql

Please help. I got these error. I'm try to pass variable extract from data-file.txt to sql file(select.sql).

cat: cannot open select
cat: cannot open *
cat: cannot open from
cat: cannot open user
cat: cannot open where
cat: cannot open name=$list;

#!/bin/bash

list=`sed q "data-file.txt"`
sqlfile=`cat select.sql`
script=$(eval echo $(cat $sqlfile))

echo "$script"
sqlplus -s user/password@instance <<EOF
$script
EOF

cat select.sql
select \* from prepaid_invoice where invoice_no=$list;

Thank you

Why don't you use

sqlplus -s user/password@instance @select.sql

If your sql file contains reference to variable of your script, you can do something like in this example :

$ cat ev.sh
my_var=Magic
eval text=\"$(<ev.txt)\"
cat <<EOD
$text
EOD
$ cat ev.txt
Value of variable my_var is ${my_var}  
$ ./ev.sh
Value of variable my_var is Magic 
$ 

Jean-Pierre.

If I do like this, when I run the script,it will be asking to enter value manually. And I don want this...

Enter value for list: 1234567890
old 1: select * from table where list='&list'
new 1: select * from prepaid_invoice where
list='1234567890'

---------- Post updated at 04:17 AM ---------- Previous update was at 04:15 AM ----------

Could u elaborate more. I'm new in shell scripting. Still a lot need to learn.
Could u give example based on my code. Or how to use it with my code. Thank you.