Escape character in sed

Hello experts

I am trying to write a shell script which will add ' ' to a unix variable and then pass it to oracle for inserting to a table.

I am running the script as root and I have to do a su -c .
The problem is the character ' is not recognised inside sed even after adding escape character \

Here is my script
----------------------
su - oracle -c '. $HOME/.profile; a=10;quote=`echo a | sed -e s/a/\'/g`;echo $quote;hosted=`hostname`; host=$quote$hosted$quote;

sqlplus scott/tiger <<EOF

insert into unix_box values($host,0,sysdate);
commit;
EOF
'
-----------------------
Error ->
test3.sh: 0403-057 Syntax error at line 1 : ``' is not matched.

How can we add the escape character ' to quot variable .

I am running this script on AIX 5 under shell sh.

Thanks & Regards
Vedaa

You cannot enclose single quotes inside other single quotes even if you escape it.

Use double quotes for the outer quotes, and use a backslash to escape characters such as $ inside them.