Skip to content

SQL String Constants

This section describes string constants in SQL, also known as character literals. This section also shows how to escape and include both printable and non-printable characters within string constants. Yellowbrick supports C-style and Unicode escape sequences for literal text within SQL statements.

A SQL string constant is any sequence of characters enclosed by single quotes ('). For example:

'We are such stuff as dreams are made on'
'Man Utd'
'06172019'

To identify a single-quote character inside a string constant, use two adjacent single quotes. For example:

'A Midsummer Night''s Dream'
'St. Mary''s Stadium'

Two adjacent single quotes have a distinct meaning from the double-quote character (").

Although it is typically only used to enclose the text of procedures that contain embedded quotes, dollar quoting is also allowed in literal strings. For example:

premdb=# select $$St. Mary's Stadium$$ as dollar_quoted_string from sys.const;
 dollar_quoted_string 
----------------------
 St. Mary's Stadium
(1 row)

In This Section

Parent topic:Yellowbrick Documentation