while IFS=# read -r process_id source destination type
do
echo "Process id: $process_id"
echo "Source: $source"
echo "Destination: $destination"
case "$type" in
2)
echo "Type is outbound: $type"
contact=$(sqlplus -s ${SQLPLUS_INFO} <<EOF
SET PAGESIZE 0
SELECT email FROM table WHERE partner = '${destination}';
exit
EOF
)
echo
echo ${contact}
echo
;;
Based in the code above, how can I pass the value from $destination to the query? The example above is not working, even these other ones:
SELECT email FROM table WHERE partner = '"${destination}"';
SELECT email FROM table WHERE partner = '$destination';
contact=$(and)just to see if that is source of the problem. I would expect this to work as is, but the command-substitition ($( ...)) might be a problem. Good luck.export destinationbefore calling thecontact=$(....). Good luck.contact=$(AND)(only).Add anexitstatement right after EOF, to see if thesqlplus <<EOS ... EOSstuff is working, without worrying about the assigning to the variablecontact. As usual, JonathanL is giving you excellent advice. I would add that you're getting into complicated territory, you'll have to slow down a bit and take the time to understand what each bit of syntax that is added to your script is doing, both in a basic sense as well as what you hope it is doing in your particular case. Good luck.!