The Q-quote delimiter can be any single- or multibyte character except space, tab, and return. If the opening quote delimiter is a [, {, <, or ( character, then the closing quote delimiter must be the corresponding ], }, >, or )character. In all other cases, the opening and closing delimiter must be the identical character.
oracle10g以后开始引入的一个新特性:q-quote
使用Q或q开头(如果是national character literals,则是将N或n放在Q或q之前),字符串的前后使用界定符“ ' ” 单引号括起来。
注:q-quote的界定符可以是除了TAB、空格、回车以外的任何单字节或双字节字符;一般情况下,可以统一使用{} 或[]或 <>或 () 作为界定符。
使用方法如下:
select q'[select 'hello' as str from dual]' as q_str from dual;
查询结果如下:
或者带双引号的,如下:
select q'[select 'I say "hello"' as str from dual]' as q_str from dual;
这样就比每次需要写单引号的时候,用多个单引号括起来要更方便一些。
--------------------------------------------------------------------------