数据仓库服务 GaussDB(DWS)-字符处理函数和操作符:quote_nullable(string text)

时间:2025-02-12 15:05:09

quote_nullable(string text)

描述:返回适用于在SQL语句里当作字符串使用的形式(使用适当的引号进行界定)。

返回值类型:text

示例:

12345
SELECT quote_nullable('hello'); quote_nullable ---------------- 'hello'(1 row)

如果出现如下写法,text文本将进行转义。

12345
SELECT quote_nullable(E'O\'hello'); quote_nullable---------------- 'O''hello'(1 row)

如果出现如下写法,反斜杠会写入两次。

12345
SELECT quote_nullable('O\hello'); quote_nullable---------------- E'O\\hello'(1 row)

如果参数为NULL,返回NULL。

12345
SELECT quote_nullable(NULL); quote_nullable---------------- NULL(1 row)
support.huaweicloud.com/sqlreference-dws/dws_06_0030.html