Solved

Oracle escape character

Posted on 2001-08-22
2
20,729 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
Comment Utility
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
Comment Utility
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.

Join & Write a Comment

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now