How do I ignore ampersands in a SQL script running from SQL Plus? How do I ignore ampersands in a SQL script running from SQL Plus? oracle oracle

How do I ignore ampersands in a SQL script running from SQL Plus?


This may work for you:

set define off

Otherwise the ampersand needs to be at the end of a string,

'StackOverflow &' || ' you'

EDIT: I was click-happy when saving... This was referenced from a blog.


If you sometimes use substitution variables you might not want to turn define off. In these cases you could convert the ampersand from its numeric equivalent as in || Chr(38) || or append it as a single character as in || '&' ||.


I resolved with the code below:

set escape on

and put a \ beside & in the left 'value_\&_intert'

Att