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
set feedback off
set pagesize 0
set sqlprompt ""
set verify off
set 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?
set sqlprompt ' '(single quotes)<<-EOQ3to<<EOQ3set linesize 300, maybe sqlplus wrap somehow the output. And alsocolumn file_name format a50may help