DISQUS

Eddie Awad’s Blog: 3 Useful SQL*Plus Tips

  • John Flack · 2 years ago

    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.

  • Eddie Awad · 2 years ago

    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.

  • Fahd Mirza · 2 years ago

    Thanks for the tips.