Why can't I proceed non-English characters with N' when specifying the value for an input parameter in an SAP HANA "SQL" query, while I can for an input variable?
For example, the following query works (notice the N' in the WHERE clause generated by an input variable):
SELECT
"NDATA", "DATA", "CC_NON_ENGLISH"
, sum("ID") AS "ID"
FROM
"_SYS_BIC"."Test/MY_VIEW"
('PLACEHOLDER' = ('$CC_PARAM$', 'दिल्ली भारत की राजधानी है.'))
WHERE
(("NDATA" IN (N'दिल्ली भारत की राजधानी है.')))
GROUP BY
"NDATA", "DATA", "CC_NON_ENGLISH"
However, if I add N' in front of the value for the CC_PARAM variable, I get a syntax error.
SELECT
"NDATA", "DATA", "CC_NON_ENGLISH"
, sum("ID") AS "ID"
FROM
"_SYS_BIC"."Test/MY_VIEW"
('PLACEHOLDER' = ('$CC_PARAM$', N'दिल्ली भारत की राजधानी है.'))
WHERE (("NDATA" IN (N'दिल्ली भारत की राजधानी है.')))
GROUP BY
"NDATA", "DATA", "CC_NON_ENGLISH"
The resulting error:
Could not execute 'SELECT "NDATA", "DATA", "CC_NON_ENGLISH", sum("ID") AS "ID" FROM ...'
SAP DBTech JDBC: [257]: sql syntax error:
incorrect syntax near "दिल्ली भारत की राजधानी है.": line 7 col 3 (at pos 173)
In general, when writing SQL queries in HANA, when does a Unicode string need to be preceded by N' and when doesn't it?
I notice that I can execute the query in question without any N' at all and it works fine, so what's going on here?