Solved

how to insert values containing '&'  into a table

Posted on 2008-06-18
4
678 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
[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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle collections 15 53
UTL_FILE invalid file operation 5 57
error doing substr 3 51
Convert CSV to list in oracle for IN-Clause 6 45
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…
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…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

734 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