Book Contents

Book Index

Next Topic

Home

String Constants (Dollar-Quoted)

The standard syntax for specifying string constants can be difficult to understand when the desired string contains many single quotes or backslashes. To allow more readable queries in such situations, Vertica SQL provides "dollar quoting." Dollar quoting is not part of the SQL standard, but it is often a more convenient way to write complicated string literals than the standard-compliant single quote syntax. It is particularly useful when representing string constants inside other constants.

Syntax

$$characters$$

Semantics

characters is an arbitrary sequence of UTF8 characters bounded by paired dollar signs ($$).

Dollar-quoted string content is treated as a literal. Single quote, backslash, and dollar sign characters have no special meaning within a dollar-quoted string.

Notes

Examples

=> SELECT $$Fred's\n car$$;

?column?

-------------------

Fred's\n car

(1 row)