------------
tab=$1
sqlplus -S "uname"/"password" <<sqlsptdem
col object_name format a50
set pagesize 50000
spool sql_output.log
select cust_name from customer where customer_id=$1;
sqlsptdem
------------
save above code with .sh extension,
give appropaite uname and password .
$1 and $2 indicate command line parameters, u can hard code it for testing purpose if u want.
u will get the result in "sql_output.log" file