I am having trouble figuring out why I am getting the error defined in the title.
The other day I was having the same trouble in a similar script but with `<<' unmatched. I then found this which helped me solve my problem. I am having trouble applying the same sort of fix to this issue.
My block:
+95 master_table=$(sqlplus -s <<- EOF
+96 ${SQLMSTR}
+97 select * from UTILS.PAGE_TO;
+98 EOF
+99 )
I can get it to work if I remove all whitespace before EOF
on line 98
. Can anyone help me understand what I am doing wrong?
I'm using ksh93
My "other" block from a separate script that works (there is whitespace before each line on script):
sqlplus -s <<- EOF
${SQLMSTR}
exec utils.change_page('${TEAM}');
EOF
Change <<-
to <<
and shift EOF
to the beginning of the line:
+95 master_table=$(sqlplus -s << EOF
+96 ${SQLMSTR}
+97 select * from UTILS.PAGE_TO;
+98 EOF
+99 )
I know it looks ugly. One way to work around this is to create a function that takes the SQL statement as an argument and runs it. Like this:
function run_sqlplus() {
sqlplus -s << EOF
${SQLMSTR}
$@
EOF
}
: indented code
master_table=$(run_sqlplus 'select * from UTILS.PAGE_TO;')