Categories: String
QUOTE
Returns a result that can be used as a properly escaped data value in a SQL statement.
Syntax
QUOTE(expression string) → string
- expression: The input string.
Examples
QUOTE exampleSELECT QUOTE('Dremio')
-- 'Dremio'
SELECT QUOTE('Sonar''and''Arctic')
AS Escaped_String
-- 'Sonar\'and\'Arctic'
SELECT *, QUOTE(total_amount)
FROM "Samples"."samples.dremio.com"."NYC-taxi-trips"
LIMIT 3
-- pickup_datetime, passenger_count, trip_distance_mi, fare_amount, tip_amount, total_amount, EXPR$6
-- 2013-05-27 19:15:00.000, 1, 1.26, 7.5, 0.0, 8.0, '8.0'
-- 2013-05-31 16:40:00.000, 1, 0.73, 5.0, 1.2, 7.7, '7.7'
-- 2013-05-27 19:03:00.000, 2, 9.23, 27.5, 5.0, 38.33, '38.33'
Usage Notes
The string is returned enclosed by single quotation marks and with each instance of backslash (\), single quote (‘), ASCII NUL, and Control+Z
preceded by a backslash (\). If the argument is NULL
, the return value is the word NULL
without enclosing single quotation marks.