sql insert command

Hi,

sqlplus -s / <<EOF > /dev/null
insert into table1 (a1, a2, a3) values ('a',1,'b');
commit;
EOF

in the above code can i pass the values to the insert command from shell script like this:

insert into table1 (a1, a2, a3) values ('$a',$b,'$c');

If yes, how is it passed??

Any help greatly appreciated. (I found some similar threads but culdn't find any particular soln to this)

thanks,

abey

The problem is that you require ' characters to delimit strings. Here is a workaround not using a here doc:

userid=me
pswd=mypassword
 command=$(
 echo "$userid/$pswd"
 printf "insert into table1 (a1, a2, a3) values ('%s','%s','%s');\n" $a $b $c
 echo "commit;"
 echo "exit")
 echo "$command" | sqlplus -s
a='abc'
b='def'
sqlplus -s / <<EOF
    select '${a}', '${b}' from dual;
EOF