Solution 1:
If you are not using substitution variables (&1 &2 &3 etc.) you can do a “SET DEFINE OFF” or “SET SCAN OFF” to turn off the definition of the ampersand as a substitution variable.
Example:
SQL> SET DEFINE OFF
SQL> INSERT INTO <table_name> VALUES (‘AT&T’);
1 row created
Solution 2:
If you are using substitution variables, set the substitution character to one which will not be encountered when inserting data.
Example:
SQL> SET DEFINE %
SQL> INSERT INTO <temp_table> VALUES (‘AT&T’)
/
1 row created.
Solution 3:
If you precede the special character with a backslash and the ESCAPE setting in SQL*Plus is set to ON, then SQL*Plus will understand the special character following the escape symbol is to be treated as a regular character.
Example:
SQL>set escape on
SQL>show escape
escape “\” (hex 5c)
SQL> INSERT INTO temp_table VALUES (’select * from emp where ename = \&
1′);
1 row created.

RSS - Posts
Shiv on LinkedIn
Shivmohan on Oracle Community
Shivmohan on Orkut
3 responses so far ↓
Mehmood // May 8, 2009 at 7:04 pm |
very nice post, I encountered the same problem, but i did that with the || sign. But this post is no doubt is nice one
guest1 // June 12, 2009 at 12:48 pm |
Thank You for the post. I am new bee to Oracle and had trouble inserting special character from SQL plus. This post was very helpful
rajesh // August 24, 2009 at 5:43 am |
very nice post, very useful to me