Unexpected eof error

Hi,
I am newbie and am just trying to connect to oracle from shell script ,,,but I am getting the following error

 ./prog.sh: line 20: syntax error: unexpected end of file

The scripts is :

#!/bin/bash
O=$IFS; IFS=",";
while read a b c d
do
echo $c
sqlplus -s training1/training1 << EOF
set serveroutput on;
BEGIN
DBMS_OUTPUT.PUT_LINE('IN SQL');
END;
/
quit;
EOF
done > file.txt

IFS=$O;

Can anyone help me

insert a "set -xv" in the second line of your script an run it. post the output from screen here...

This is the output I got

-bash-3.00$ ./prog.sh
O=$IFS; IFS=",";
+ O='
'
+ IFS=,

while read a b c d
do
echo $c
sqlplus -s training1/training1 << EOF
./prog.sh: line 19: syntax error: unexpected end of file

I've noticed there's a space between << and EOF. Try removing it:

#!/bin/bash
O=$IFS; IFS=",";
while read a b c d
do
echo $c
sqlplus -s training1/training1 <<EOF
set serveroutput on;
BEGIN
DBMS_OUTPUT.PUT_LINE('IN SQL');
END;
/
quit;
EOF
done > file.txt

IFS=$O;

See if that helps.

I have tried but still its comming.
But the following code works

#!/bin/sh
sqlplus -s training1/training1 << EOF
set serveroutput on;
BEGIN
DBMS_OUTPUT.PUT_LINE('File Open Error');

    END;

/
EOF

the last done statement is as

done < file.txt

Ohhh I got it finally..but still count not locate the error in the first code....
Can anyone point it out..:rolleyes:

#!/bin/bash
O=$IFS; IFS=",";
while read a b c d
do
echo $c
sqlplus -s training1/training1 <<EOF
set serveroutput on;
BEGIN
DBMS_OUTPUT.PUT_LINE('IN SQL');
END;
/
quit;
EOF
done < a
IFS=$O;