Edit value in File

I have a file oratab with entry like this
SCADAG:/esitst1/oracle/product/9.2.0.8:Y

I am trying to discover a way to change the 9.2.0.8 part of this to something like 10.2.0.4 as part of an upgrade script.

I have tried
cat /etc/oratab >>/tmp/oratab
ORACLE_HOME=/esitst1/oracle/product/9.2.0.8
export ORACLE_HOME
NEW_HOME=/esitst1/oracle/product/10.2.0.4
export New_HOME

sed -e "s/${ORACLE_SID}:${ORACLE_HOME}/${ORACLE_SID}:${NEW_HOME}/g" /tmp/oratab >/etc/oratab

If I read it correctly, it appears not to like the forward slashes.

Any suggestions as how to do this would be greatly appreciated. I may be even going down the wrong road here.

Thanks

sed allows alternative separators for precisely this reason.

sed -e "s%${ORACLE_SID}:${ORACLE_HOME}%${ORACLE_SID}:${NEW_HOME}%g

It's "turtles all the way down" if you can't find a character which is guaranteed not to be in the replacement strings, though.

I have been known to write sed scripts which write sed scripts with all the special characters in the input backslashed, but there are obviously more elegant solutions. (Perl comes to mind, and should be easy to get started with if you know sed.)