Solved

Oracle escape character

Posted on 2001-08-22
2
20,748 Views
Last Modified: 2011-08-18
Hi,

I am working with SQL plus on oracle database. When I try to insert a string that contains escape character like '&', it prompts for asking input for variable substitution as below:

Input query: "update table1 set column1 = 'AB&C'
Prompt: "Enter value for C:"

I try to add a slash before the '&' but it works the same.
Also, I try to blacket the '&' as '{&}' in the query and it gets success. But the field stores the '{}' at the same time. (e.g 'AB{&}C')

I would like to ask any good solutions to handle such escape characters when I input query in SQL plus ?

Thanks !

Ken
0
Comment
Question by:kencheng123
2 Comments
 
LVL 3

Expert Comment

by:UsamaMunir
ID: 6416310
In SQL* do this

SQL> Set scan off

SQL> update dept set dname = 'A&BC';
5 rows updated.


Setting the scan off tells sqlplus that dont scan for variables in the statements.

Regards
U
0
 
LVL 1

Accepted Solution

by:
dsthas earned 100 total points
ID: 6416428
As UsamaMunir states can "set scan off" do the job for your update command.

An alternative is to use escape-sharacters, which makes it possible to be prompted for some parts of the SQL.
Enable the use of escape-characters (default it is off)
SQL> set escape on

The escape character is backslash ("\"), but you can change it if needed, fx "set escape #".

Regards
Hans Henrik
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
automatic email alert 1 50
Converting a row into a column 2 51
How to Gracefuly recover in Racle stored procedure 1 29
grant user/role question 11 28
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question