Solved

escape characters

Posted on 2002-03-12
5
8,556 Views
Last Modified: 2013-12-03
I am using oracle 8.1.6 on win NT4. I want to know escape characters for all keyboard
characters. What I mean is insert into emp(empno,ename) values(1111,'br'o'neal'); will fail.
But insert into emp(empno,ename) values(1111,'br''o''neal'); will succeed.
I know select ascii('&') from dual;
ascii('&')
----------
   38
insert into emp(empno,ename) values(2222,'P' || chr(38) || 'G'); works.
Also, rpad, lpad or both can be used to get around the problem.
So, ' is escape character for '. I want these type of escape characters for all keyboard
characters. More important and urgent need is for hyphen('-') and ampersand('&'). Can we make
use of default or set escape character of SQL*Plus i.e. '\' etc. while selecting OR inserting.
If so how. Also, can we make it database based with a setting in parameter files so that it is
permanent and applies to all client windows and application programs that use oracle as
backend. Will it help if I use replace and translate functions to avoid prompting for value when inserting '&' and other such problems. -----sesh2002
0
Comment
Question by:sesh2002
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 6858276
Yes, you can change the escape character in SQL*Plus and you can "set define off" if you want to, so SQL*Plus will not treat the ampersand (&) as a substitution variable marker.

No, you cannot do this in the database and have it apply to any/all clients.  Oracle client programs always over-ride database defaults if the value can be specified in both the server and the client.

Also these SQL*Plus settings only apply to SQL*Plus, but that is not the tool most people use for data entry and queries with an Oracle database.  Sure, developers and DBA's use it, but your users don't, do they?
0
 
LVL 7

Accepted Solution

by:
yoren earned 50 total points
ID: 6858278
Hi sesh,

The problems you describe with escape sequences and ampersands don't appear in non-sqlplus applications (when you use bind variables). Here's what to do for SQL*Plus:

Edit the global login file which is executed for all SQL*Plus sessions: [orahome]/sqlplus/admin/glogin.sql

In that file, add the command "set scan off". That will prevent any '&' prompting for users of sqlplus.

-Yuval
0
 
LVL 7

Expert Comment

by:yoren
ID: 6858309
Clarification to my previous comment: you will have to modify the glogin.sql file on every client machine.
0
 

Author Comment

by:sesh2002
ID: 6860780
Dear Experts, I will give it to the one who gives me a escape character like ' for ' for as many characters as possible OR at least circumventing the problem using replace, translate functions and '\' etc.
0
 

Author Comment

by:sesh2002
ID: 6881970
Sorry markgeer, your answer also worked, but it goes to one only. Yoren, read my earlier comment and pleave give me an answer - sesh2002
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses

630 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