Help needed desperately......

Hi guys,

I want to execute an SQL script based on a condition.... I am writing a sample requirement...

num = {some value}

if(num == 0)
then
cat>> test.sql <<FIN
select * from table_a
FIN
else
cat>> test.sql << FIN
select * from table_b
FIN
fi

This is what i wish to implement... I have implemented this in my code but seems to give and error in this part "<<FIN" (unmatched << found)...

Running the code only with the script that is without the conditional if statement no error is generated...

Has anyone encountered anything like this... plz suggest something... its very urgent for me.. kindly help....

num=0

if [ $num -eq 0 ]
then
echo "Num 0"
else
echo "Num NOT 0"
fi

hi ikon,,

i have already tried that format of if still it is giving that error that i jst mentioned... any other suggestion??

The one I posted is NOT like the one you posted..

you were missing "$" and you have to watch spaces between commands and vars.