Problem while storing sql query value in a variable

Hi,

When i execute the below statement , the value is not getting stored in the variable.

AnneeExercice=`sqlplus $LOGSQL/$PASSWORDSQL << FIN >> $GEMOLOG/gemo_reprev_reel_data_ventil_$filiale.trc
SELECT bi09exercice
FROM bi09_scenario
WHERE bi09idfiliale=UPPER('de')
AND bi09flagcourant='O'
AND bi09cycle='R' ;
FIN`

I got struck at this point. Can you please suggest me whats wrong in the statement.

Well, you are redirecting standard output to $GEMOLOG/gemo_reprev_reel_data_ventil_$filiale.trc
Either remove this redirection or change the ">>" into "2>"...
At least, assuming all the other stuff is OK... :slight_smile: