Error"syntax error at line 15: `end of file' unexpected"

While i m running below code, it is giving me the error"syntax error at line 15: `end of file' unexpected".

Pls let me know what is wrong here..i tried many ways, but no luck

 
dbSID="SWQE"
usrname="apps"
password="Wrgthrk3"
count=0
while [ $count -lt 3 ]
do
    sqlplus $usrname/$password@$dbSID <<-EOF 
    WHENEVER OSERROR EXIT 9;
    WHENEVER SQLERROR EXIT SQL.SQLCODE;
    prompt Connected to the database;
    quit;
    EOF
  count=`expr $count + 1`
done

Try this :slight_smile:

do
    sqlplus $usrname/$password@$dbSID <<-EOF 
    WHENEVER OSERROR EXIT 9;
    WHENEVER SQLERROR EXIT SQL.SQLCODE;
    prompt Connected to the database;
    quit;
EOF  -------------NOTE: This should start at the very beginning!! 
1 Like

"-EOF" != EOF

No, it is not working..

Ah, I missed that part! :slight_smile:

Yeah, it worked.

dbSID="SWQE"
usrname="apps"
password="Wrgthrk3"
count=0
while [ $count -lt 3 ]
do
    sqlplus $usrname/$password@$dbSID <<-EOF 
    WHENEVER OSERROR EXIT 9;
    WHENEVER SQLERROR EXIT SQL.SQLCODE;
    prompt Connected to the database;
    quit;
EOF======================> i kept EOF without any space before i,e at the starting of the line and it worked.
  count=`expr $count + 1`
done