Re: sql*plus and using & character to prompt for input; can I escape it?
Date: 1996/06/20
Message-ID: <4qckmb$70o_at_inet-nntp-gw-1.us.oracle.com>#1/1
In article <31C977EF.6AE_at_ea.com>, "A. Fischer" <afischer_at_ea.com> writes:
|> SET SCAN OFF
|>
|> Joe Ramey wrote:
|> >
|> > We have an SQL statement that looks something like this:
|> >
|> > INSERT INTO TMS VALUES ('Crafts & Co.');
|> >
|> > When I run this through sqlplus (V 7.2.2.3.0 if it makes any
|> > difference) it says:
|> >
|> > Enter value for co:
|> >
|> > and waits for input. Now, I understand that this is a feature that
|> > allows a script to prompt the user for the value of a variable. My
|> > question is: how do I prevent this from happening? What is the
|> > correct way to escape the special meaning of the & character here?
|> > Why are the single quotes not enough?
|> >
|> > I'm told that the SQL client on NT doesn't behave the same way
|> > (meaning that the & in this context doesn't prompt the user for
|> > anything) but haven't verified this myself.
|> >
|> > Thanks for any explanation you can provide.
|> >
|> > Joe
You can turn off the substitution, or change the character used, with the
SET DEFINE command. SET DEFINE OFF will turn it off, and SET DEFINE x will
change the character to x. I got this directly from the SQL*Plus manual.
-- ------------------------------------------------------------------------ Scott Urman Oracle Corporation surman_at_us.oracle.com ------------------------------------------------------------------------ Author of _Oracle PL/SQL Programming_ ISBN 0-07-882176-2 Published by Oracle Press - http://www.osborne.com/oracle/index.htm ------------------------------------------------------------------------ "The opinions expressed here are my own, and are not necessarily that of Oracle Corporation" ------------------------------------------------------------------------Received on Thu Jun 20 1996 - 00:00:00 CEST