0

I am facing an issue while executing the following script snippet.

$ORACLEHOME/bin/sqlplus -s $DBUSER/$DBPASSWORD <<EOF
    set pages 0 feedback off
    SELECT * FROM ERR_STG_ROAMING_PARTNER;

EOF > Err_File.txt

The following error message appears.

./Roaming.sh: line 213: warning: here-document at line 206 delimited by end-of-file (wanted `EOF')
./Roaming.sh: line 214: syntax error: unexpected end of file

Any help will be appreciated.

1 Answer 1

3

Try this:

$ORACLEHOME/bin/sqlplus -s $DBUSER/$DBPASSWORD > Err_File.txt <<EOF
    set pages 0 feedback off
    SELECT * FROM ERR_STG_ROAMING_PARTNER;

EOF

That is, specify the output redirection before the input heredoc redirection. The shell expects EOF to be on its own on the line terminating the heredoc.

The error message you are getting is the shell complaining about finding end-of-file (of the script file) before finding EOF. The usage of EOF for the heredoc delimiter might lead to some confusion here!

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks mate! great help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.