You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Jo...@swisscom.com on 2021/05/06 07:40:44 UTC

NiFi QueryRecord Escape Single Quote in string

Hi guys

We would like to insert a string as a column with the QueryRecord which includes a single quote, please check my example below.

SELECT 'Can't create a text with single quote' AS message
FROM FLOWFILE

The yellow marked single quote generates a syntax error and I don’t know how to fix it. Surrounding double quotes doesn’t seem to work as in regular SQL. I tried the following with no luck:

  *   \\’
  *   \’
  *   ‘’ (Double up the single quote)

Any help would be appreciated.

Cheers Josef



Re: NiFi QueryRecord Escape Single Quote in string

Posted by Jo...@swisscom.com.
Sorry I had another issue that caused my test to fail. I can confirm that double quoting (two single quotes) work to get a single quote.

Cheers


From: "Zahner Josef, GSB-LR-TRW-LI" <Jo...@swisscom.com>
Date: Thursday, 6 May 2021 at 09:40
To: "users@nifi.apache.org" <us...@nifi.apache.org>
Subject: NiFi QueryRecord Escape Single Quote in string

Hi guys

We would like to insert a string as a column with the QueryRecord which includes a single quote, please check my example below.

SELECT 'Can't create a text with single quote' AS message
FROM FLOWFILE

The yellow marked single quote generates a syntax error and I don’t know how to fix it. Surrounding double quotes doesn’t seem to work as in regular SQL. I tried the following with no luck:

  *   \\’
  *   \’
  *   ‘’ (Double up the single quote)

Any help would be appreciated.

Cheers Josef