Forum OpenACS Q&A: How do you escape the @ sign in Oracle?

Just to make the question a little more clear I'll provide some example code from the file-storage create script ...
    template_id :=
        name  =>  'file-storage-default',
        text  =>  '<master>
<property name="title">@title@</property>
<property name="context">@context@</property>
When I leave the "@text;noquote@" at the beginning of a line, Oracle thinks it should source a file. Is there a way around this but still having it at the beginning of a new line?


Posted by Jun Yamog on
Hi Ola,

I am not sure about.  But from what I remember when I had to insert a lot of data in Oracle that included email addy that had "@".  I do a "set define off;" on top.  I am not sure if this will work.  Hope this helps.

Posted by Ola Hansson on
Hi there Jun,

I ended up using "set escape on" before the transaction I had the code in, and a "\" in front of the "@". The default escape character ("\") is disabled by default.

"set define on" is useful for dealing with strings with ampersands ("&"). At least that's what I learned from some Googling ...


Posted by Don Baccus on
What happens if you assign the string to a Tcl var then use the bindvar notation to stuff it into Oracle?

That should trick it, no?  Seems easier than remembering to set escape on all the time.