Problem while calling Oracle 10g SQLPLUS files

Hi all,

Iam facing a lot of problem while calling Oracle 10g SQLPLUS files from shell.
What is the standard procedures to be taken care.

Any help would be useful for me.

Thanks in advance,
Ganapati.

tablename="TAB"
spoolfile="myfile.txt"
sqlplus user/pwsd -s<<EOF
spool "$spoolfile"
select * from "$tablename";
exit
EOF

Here document.

But for Oracle 10g, our job is using "SQLPLUS.SH".

What is the syntax to use "SQLPLUS.SH". Also I've to store the result of this SQLPLUS call to one variable.

RESULT=`sqlplus.sh -s $USERID_PASSWORD $SQLFILE $PARAMETER`

In the above case Iam not able to assign the result to variable and also not able to use -s option.

Could you pls suggest.

Ganapati.