Escaping double quote marks in Oracle

by Granville Bonyata on July 23, 2014

When quoting strings, one of the annoying tasks is switching the single quotes to double quotes:

To work with the string “It’s the dog’s toy” requires turning the single quotes into double:

‘It”s the dog”s toy’.

In 10g Oracle introduced Q-Quote delimiters:

For literals where doubling the quotes is inconvenient or hard to read, you can designate an escape character using the notation q’esc_char … esc_char’

Some examples from the docs:

q'(name LIKE '%DBMS_%%')'
q'<'Data,' he said, 'Make it so.'>'
q'"name like '['"'

Previous post:

Next post: