字符字符串字面量

字符字符串字面量是由预定义字符集中的字符组成的序列,两边加上单引号。

语法

'character-seq'

参数

嵌入式单引号

如果字符字符串字面量包含单引号,则必须成对出现。例如:

=> SELECT 'Chester''s gorilla';
  ?column?
-------------------
Chester's gorilla
(1 row)

符合标准的字符串和转义字符

Vertica 按照 SQL 标准中指定的要求,使用符合标准的字符串,将反斜杠处理为字符串字面量,而不是处理为转义字符。

示例

=> SELECT 'This is a string';
  ?column?
------------------
 This is a string
(1 row)
=> SELECT 'This \is a string';
   WARNING:  nonstandard use of escape in a string literal at character 8
   HINT:  Use the escape string syntax for escapes, e.g., E'\r\n'.
     ?column?
------------------
 This is a string
(1 row)
vmartdb=> SELECT E'This \is a string';
     ?column?
------------------
 This is a string
=> SELECT E'This is a \n new line';
       ?column?
----------------------
 This is a
 new line
(1 row)
=> SELECT 'String''s characters';
      ?column?
--------------------
 String's characters
(1 row)

另请参阅