q-quote
1) q-quote界定符可以是除了TAB,空格,回车外的任何单字节或多字节字符。
2) 除了单字节的的开始界定符是[,{,<,(,那么结束界定符必须是],},>,) 其他开始界定符与结束界定符必须一致
q-quote界定符的内字符串可示为单引号。而字符串的起止位置以界定符为准。
SQL> SELECT '双写'',两个单引号显示为一个' AS s FROM dual; S --------------------------- 双写',两个单引号显示为一个 SQL> SELECT q'[界定符内',一个单引号即可]' AS s FROM dual; S ------------------------- 界定符内',一个单引号即可
b 少了一个单引号,正确写法为
SQL> SELECT prod_name || q'['s ]' || ' category is ' || prod_category categories 2 FROM products 3 WHERE rownum <= 2; CATEGORIES -------------------------------------------------------------------------------- 5MP Telephoto Digital Camera's category is Photo 17" LCD w/built-in HDTV Tuner's category is Peripherals and Accessories
Answer: CD
SQL> SELECT prod_name || q'\'s\' || ' category is ' || prod_category CATEGORIES FROM products 2 where rownum <=2; CATEGORIES ------------------------------------------------------------------------------------------------------------------- 5MP Telephoto Digital Camera's category is Photo 17" LCD w/built-in HDTV Tuner's category is Peripherals and Accessories 已选择2行。 SQL> SQL> SELECT prod_name || q'<'s >' || 'category is ' || prod_category CATEGORIES FROM products 2 where rownum <=2; CATEGORIES ------------------------------------------------------------------------------------------------------------------- 5MP Telephoto Digital Camera's category is Photo 17" LCD w/built-in HDTV Tuner's category is Peripherals and Accessories 已选择2行。