When I execute following shell script I am getting the following error
syntax error at line 50 : `<<' unmatched
What am I doing wrong
Script begins here
----------------
MPAN_FILE=$1
exec 3<$MPAN_FILE
while read -u3 -r Outcode Incode Depot
do
echo $Outcode
echo $Incode
echo $Depo
{
sqlplus -S abc/xyz <<EOF
set heading off feedback off serveroutput on
DECLARE
DEPO number;
BEGIN
-- Attempt to find the depo
SELECT DEPOT_CODE
INTO DEPO
FROM DEPOT
WHERE UPPER(DEPOT_LKVAL) = UPPER('${Depot}');
-- Found it, print the depo
DBMS_OUTPUT.PUT_LINE (Depo);
EXCEPTION
-- No depo
WHEN NO_DATA_FOUND THEN
SELECT -1
INTO Depo
FROM dual;
DBMS_OUTPUT.PUT_LINE (Depo);
WHEN OTHERS THEN
SELECT -2
INTO Depo
FROM dual;
DBMS_OUTPUT.PUT_LINE (Depo);
END;
/
EOF
} | read Depo
echo $Depo
if [ ${Depo} -ge 0 ]
then
echo 'Success'
{
sqlplus -S abc/xyz <<EOF
set heading off feedback off serveroutput on
DECLARE
Err number;
BEGIN
-- Attempt to Insert the data into depot_postal_area
INSERT INTO DEPOT_POSTAL_AREA
(SUPPLIER_CODE,DEPOT_CODE,POST_OUTCODE,POST_INCODE)
VALUES
(12,${Depo},'${Outcode}','${Incode}');
INSERT INTO DEPOT_POSTAL_AREA
(SUPPLIER_CODE,DEPOT_CODE,POST_OUTCODE,POST_INCODE)
VALUES
(13,${Depo},'${Outcode}','${Incode}');
Err := 0;
DBMS_OUTPUT.PUT_LINE (Err);
EXCEPTION
-- No depo
WHEN OTHERS THEN
SELECT -1
INTO Err
FROM dual;
DBMS_OUTPUT.PUT_LINE (Err);
END;
/
EOF
} | read Error
echo $Error
else
echo 'Failed'
fi
done