Raba - Defend your code RSS 2.0
# Saturday, December 10, 2005

Every one who write queries in Oracle knows that for inserting comma (') into a varchar field you need to double it, which will look like this:

insert into shops(shop_name, description)
values ('Adam''s shop', 'selling bugs for free');

But I've found out this one too (and also found out that there are many of you that don't know this trick)
try to write the query with this special character - &  (And)
Oracle will think that this one is a parameter asking you to insert value.
so I said why not double it too.

update shops
set      shop_name='Lorel&&Hardy'
where  code = 69;

Do not try those tricks at home.

Saturday, December 10, 2005 8:20:08 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
DataBase

Archive
<December 2005>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2012
Shani Raba
Sign In
Statistics
Total Posts: 145
This Year: 0
This Month: 0
This Week: 0
Comments: 97
Cool Stuff
Add to Technorati Favorites
Themes
Pick a theme:
All Content © 2012, Shani Raba
DasBlog theme 'Business' created by Christoph De Baene (delarou)