The real cause of the problem is, as teebones has pointed out, the ` at the end of EOF. The ` should be at the end of the command - the hereis document ends with a line containing EXACTLY AND ONLY the content of the initial tag. Add that ` and it breaks, as you've found. That line should look like
Code:
no_of_constraints=`sqlplus -s $OracleId 2>/dev/null` <<EOF
I find it easier to echo the command in, personally.