Question
· Sep 4, 2017

SQLQuery: Cannot use JSON_OBJECT with literals

Hello, I just noticed that the following query is not allowing when using cached queries.

The compiler will accuse the code about missing a closing quote.
Just so you know, if I use this query dynamically it works, so I guess it's related to the code linting.

Query T() As %SQLQuery [ SqlProc ]
{
SELECT TOP 3 JSON_OBJECT('lit':'Employee from','t':%TABLENAME,'name':Name,'num':SSN) FROM Sample.Employee
}

The bold part is what is causing the error.

Version 2017.

Discussion (4)0
Log in or sign up to continue

I got the same error, with %SQLQuery and embedded SQL (&sql), and in 2017.2 too.

Looks like some error, and you should say about it to the WRC.

  SQLCODE=-3 : Closing quote (') missing
 SELECT TOP 3 JSON_OBJECT('lit':'Employee from','t':%TABLENAME,'name':Name,'num':SSN) FROM Sample.Employee

While it works perfectly with %SQL.Statement, and through Management Portal

Or just from the documentation page, here.