UNIX shell script error: not found

Hello All,

I'm working on one Unix shell sript that will actually extract a column data from Oracle table using sqlplus and writes onto a file. I'm getting this error when executing the shell script:

rpt.ksh[156]: ^JScott: not found

Below is the code in the shell script:

 `sqlplus -s ${TEST DB} <<EOF
    WHENEVER OSERROR EXIT 9
    WHENEVER SQLERROR EXIT SQL.SQLCODE
set trim on
set tab off
set linesize 8000
Select emp_name FRom EMP_A S where empno=1;
EOF` >> /dev/xyz.txt

The query in the Shell script would retrieve one value i.e Scott

I have executed the query in SQLPLUS editor and I could see o/p being displayed.

Looks like an issue in writing the column value(special character getting appended i.e ^J) onto the text file by the shell script.

Please suggest.

Thanks in Advance.

Regards,
Venkat
Can you please suggest?

Fun Fact:

Being the first word in the line, the shell will try to execute the result of the command substitution.

Fun UNIX Fact