-
Website
http://awads.net/wp/ -
Original page
http://awads.net/wp/2007/03/25/3-useful-sqlplus-tips/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
jgarry
3 comments · 1 points
-
Andy C
22 comments · 47 points
-
dahowlett
1 comment · 2 points
-
Don Seiler
9 comments · 1 points
-
davidhaimes
4 comments · 3 points
-
-
Popular Threads
I'd never seen the Q quoting mechanism, thanks for pointing it out. I've written some generators and gotten SO confused quoting quotes. I wrote some helper functions - one, oddly enough, is called Q, and simply puts single quotes around any string. So instead of: 'title:=''My Title'';' I write 'title:='||q('My Title')||';' This looks more complicated in the example, but when you have lots of this stuff, it winds up more readable. I also use REPLACE a lot.
John, you may also want to take a look at REGEXP_REPLACE, it is powerful and can be very helpful.
As I understand it, the idea behind the Q- quoting mechanism is to minimize confusion and maximize readability when dealing with string literals that may have lots of single-quoting in them. The Q- quoting mechanism was only introduced in 10gR2. So, what’s new is important.
Thanks for the tips.