Upfront let me apologize if this is a noob question - I'm an experienced database programmer but not at all with Linux scripting.
I have an Oracle database table that is storing the full path and name of a file in a table column. In a SQL client I can run:
select file_name from table where request_id=12345
and I will get this result:
/home/example_path/example_file_name_1.xls
In a bash script I have this statement (which I largely copied from another example I'm working from):
# Get Actual Output File Name
VREQID=12345
ATTACH_FILE=$(sqlplus -s $ORA_USER_PSSWD <<-EOQ3
set heading off feedback off pagesize 0 sqlprompt "" verify off pause off
select file_name from table where request_id=($VREQID)
/
EOQ3
)
echo 'ATTACH_FILE: ' "$ATTACH_FILE"
# Script continues...
My echo statement is then showing:
/home/example_path/example_file_name_ 1.xls
There's a space between the underscore and the 1. I've tried using quotes to prevent this but it didn't help.
What is causing this and how do I prevent this?
Thanks in advance.