Solved

Oracle escape character

Posted on 2001-08-22
2
20,758 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
exp/imp 25 87
Oracle DB Slows After Datapump Until Next Reboot 27 95
Oracle 12c Default Isolation Level 17 41
why truncate is faster than delete in oracle ? 4 28
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
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 how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

830 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