Solved

how to insert values containing '&'  into a table

Posted on 2008-06-18
4
673 Views
Last Modified: 2013-12-19
When i try to insert a value with & into a table, like

insert into test_tab (test_field) values ('&test');

Oracle is substituting it before it gets passed to the oracle server. How can i make the insertion successful.

Please, clarify.
0
Comment
Question by:Prashanth_atthaluri
  • 2
4 Comments
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 150 total points
ID: 21812118
in your sql*plus script put

set define off

before your insert lines
0
 

Author Comment

by:Prashanth_atthaluri
ID: 21812143
What to do if am not using SQL*PLUS.
0
 
LVL 22

Accepted Solution

by:
DrSQL earned 350 total points
ID: 21812211
Prashanth_atthaluri,
     I'm not sure what tool you are using.  The '&' substitution is a SQL*Plus convention, not an Oracle-wide one.  Most other tools (like Toad) have an escape character (like the "\").  You can also use the chr function to get an ampersand:

insert into test_tab (test_field) values (chr(38)||'test');

The '&' is an ascii 38.  The double bars are the concatenation characters.

Good luck!
DrSQL
0
 

Author Closing Comment

by:Prashanth_atthaluri
ID: 31468306
Thank You both for the solution.
If I have offended any one of you by splitting the points, I am sorry.
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

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…
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 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.

820 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