I am trying to use the value of 'P' in the second SQL procedure however it doesnt take the value. Please suggest.
P=`sqlplus -s $OraInfo <<!EOF
SET ECHO ON
SET SERVEROUTPUT ON SIZE 1000000
SET LINE 900
SET WRAP ON
SET HEADING OFF
SET TRIMOUT ON
SET TRIMSPOOL ON
select i_rea_enrl from NTA_ENRL WHERE I_ENRL_ASG='$f2';
print
exit;
!EOF`
echo $P >> $LOG_FILE
Q=\'$ShellName\'
`sqlplus -s $OraInfo <<-! >> $LOG_FILE
SET ECHO ON
SET SERVEROUTPUT ON SIZE 1000000
SET LINE 900;
SET WRAP ON;
exec STAPROC.STA_NTA_ENRL_PP7_PKG.ADD_TO_STAGE($P,'PP7','$f2');
print
exit;
!EOF`
<<-!to start the here document, but you have!EOFwhere you wanted an end marker. Make the start and end markers consistent. I suggest deleting the question since you have a simple typo which no-one else will benefit from.