以下查询中的那些感叹号(!)是什么?
l_sql := q'!
SELECT CASE WHEN FILTER_CNT = 0 THEN NULL ELSE FILTER_LIST END AS FILTER_LIST
FROM
(
SELECT 'TABLE_NAME NOT LIKE ' || LISTAGG(''''||EXCLUSION_CRITERIA||'''', ' AND TABLE_NAME NOT LIKE ') WITHIN GROUP (ORDER BY ROWNUM) AS FILTER_LIST, COUNT(*) AS FILTER_CNT
FROM !'|| p_after_owner ||q'!.UT_TABLE_EXCLUSION
WHERE EXCLUSION_TYPE = 'P'
)
!';
答案 0 :(得分:6)
q
引用字符串的方法意味着您不必在字符串中转义单引号。
根据the documentation,它的工作方式如下:
q'<single character delimiter><text><single character delimiter>'
因此,示例字符串中的!
用作引号定界符。
例如,如果您想使用字符串Don't worry, be happy
,以旧式引号将变为:
'Don''t worry, be happy'
但新的报价机制为:
q'!Don't worry, be happy!'
或
q'{Don't worry, be happy}'
等