QUOTE_LITERAL

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns a string suitably quoted to be used as an SQL string literal.

Syntax

quote_literal(<string>)

Arguments

Required

  • <string>: The string to quote.

Returns

Returns a text value with appropriate quoting for use as a string literal.

Considerations

  • Embedded single quotes and backslashes are properly doubled.
  • Returns NULL on NULL input.

Examples

Quote Literal

Quote a string with an apostrophe.

SELECT quote_literal(E'O\'Reilly') AS result;

Returns '''O''''Reilly'''.

Related Documentation