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.

  • 0
  • 0
  • 162
  • 3
  • 1

Answers

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.

Notice that if you put space after ':' then it compiles OK:

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

Comments

The bold part is what is causing the error.

And where error?

And version just 2017, is not enough. Is it 2017.1 or 2017.2?

 

Cache for Windows (x86-64) 2017.1 (Build 792U) Mon Mar 20 2017 19:13:14 EDT