samedi 15 mai 2021

Run sql query from If else block in shell script

I want to connect sql db and execute sql query from shell script. I tried using this

if float_cmp "$size1 > 7.50"; then
    echo "### THE DATA SIZE IS GREATER THAN 7.5 GB ###"
    echo "############### DROPPING CREATED $IMPUSER USER ###########################"
    ${PATH_TO_CLIENT}sqlplus $EXPUSER/$EXPPWD@$ENDPOINT<< EOF
    drop user $IMPUSER cascade;
    exit;
    EOF
    exit 1
else
    echo "### THE DATA SIZE IS OKAY ###"
fi

The statement is working outside if block but throwing error when executing in IF block

line 80: warning: here-document at line 72 delimited by end-of-file (wanted `EOF')
line 81: syntax error: unexpected end of file

Can anyone please tell what am I doing wrong and what is the solution?

Aucun commentaire:

Enregistrer un commentaire