Toad World® Forums

Escaping Ampersand


#1

According to HELP in Toad (10.1.1.8) it says:

In Addition, Toad recognizes substitution variables in quotes as follows:

If & is escaped, Toad will not prompt for a value.
If & is the last value in a string, it is not considered a substition
variable.

My question is:

How do you escape an ampersand? (I’m not Houdini!!)


David
UtahToad at gmail dot com
L’Estrange:
Wickedness may prosper for awhile, but in the long run, he that sets all the knaves at work will pay them.


#2

The help is outdated in this area. There is no way to escape a & and
&& and to my knowledge this is not possible in SQL*Plus either. You can
disable substitution variable support by right-clicking in the Editor and
unchecking the “Prompt for Substitution Variables” item. Michael


#3

I will give the info at the bottom.

Try this first before going to the bottom;
image001.jpeg


#4

My reply is in reference to F9 execution, see Erwin’s post for F5 (script)
execution. Michael


#5

set escape off

works in sql plus and should work in toad when execute as script


#6

Key words: “when execute as script” And Houdini is foiled! Thanks anyway, guys!
(Better get the Help changed! :slight_smile: – David UtahToad at gmail dot com True
happiness consists not in the multitude of friends, but in the worth and
choice. --Ben Jonson Bert Scalzo wrote: set escape off works in sql plus and
should work in toad when execute as script


#7

If you are desperate, ie in a situation where you cannot use SQL*Plus for some reason, you can do this:

select chr(38)||‘x’ from dual;

I know, it’s not pretty…
Jason


#8

That which works need not be pretty. J

Daniel B Madvig
Computer Technologies

Northwestern College & Northwestern Media
3003 Snelling Ave.
St. Paul, MN 55113
www.nwc.edu

651.631.5323
image001.jpeg


#9

i just upgraded to Toad 10.6.1.3.

i use names like ‘Charly & Company’ (name is surrounded in single quotes). now toad thinks each one is a variable, I probably have 50 or so company names. i can click "delete’ to stop the variable and the query runs fine. does anyone know how to stop this altogether. i’ve never had this problem in early releases.

thanks, charly


#10

Read up about sql plus ampersands and escaping them – and then use toad
options login.sql to fix for all scenarios …


#11

Bert’s suggestion works for script execution.

For F9 (execute statement at caret) execution right-click and uncheck the
“Prompt for Substitution Variables” option. It sounds as though you may have had
this unchecked in the past. This will disable all support for subst. variables
when executing via F9.


#12

amazing how things work once you find the right menu item.
worked fine when i unchecked substitution variables.

thanks