Today I had to insert a query which contains '&' as a character. as usual this is special character in oracle. but to insert data containing '&' in it was not that simple.preceding '&' before any value makes it variables and ask for it's value at the time of execution of query. escape character \& simply didn't work which is working fine in MySQL. So here are the options you can try out to insert data containing '&'.
1) SET DEFINER off;
insert into page(id,URL) values(1,'http:///sample.com?q=1&p=2');
Problem Area : In this case &p won't be treated as variable and will be part of the string value. but suppose if you want variables data also then you can try option below.
2) SET ESCAPE \
insert into page(id,URL) values(1,'http://sample.com?q=1\&p=2');
Problem Area : you may not have permission to set DEFINER or ESCAPE so this option is best suitable.
3) insert into page(id,URL) values(1,'http://sample.com?q=1'||'&'||'p=2');
Courtesy : My senior. (Sanket).
Blogger templates
Blogger news
Blogroll
Archives
-
▼
2012
(231)
-
▼
February
(19)
- Unofficial Microsoft SQL Server Driver for PHP (sq...
- Jquery file uploader with a progress bar - Combin...
- Php IF & ELSE
- Cost
- Performance & tweaking : FOR vs. WHILE vs. DO-WHILE
- Base Language
- Cookies
- No title
- Disclaimer
- How Owning A Great Dane Is Effected By It's Person...
- Earn 500/day by click the link
- CURL di PHP
- PHP Variables
- Changing Select element content on the fly
- Variables variables en PHP
- Blocking access to the login page after three unsu...
- insert query with ampersand in oracle.
- PHP Coding Standa
- Alphabets Validation in Javascript
-
▼
February
(19)