Saturday, December 29, 2012

Escape Special Characters in Oracle while inserting data(escape ‘&’ in oracle insert)


While attempting to execute SQL insert statements using Oracle SQL Developer I keep generating a “Enter substitution value” prompt:
For Example : insert into temp(name) values(‘Hello &World’);
I’ve tried escaping the special character in the query using the ‘\’ above but I still can’t avoid the ampersand, ‘&’, causing a string substitution.
To overcome this problem execute the following command from SQL Developer .
SET DEFINE OFF;
Then insert the data : insert into temp(name) values(‘Hello &World’);
You should be able to insert