0

When trying this example from the DB2 11.1 manual:

VALUES (JSON_VALUE('{"id":"987"}', 'strict $.id' RETURNING INTEGER));

I get this error:

SQL0171N The statement was not processed because the data type, length or value of the argument for the parameter in position "1" of routine "SYSIBM.JSON_VALUE" is incorrect. Parameter name: ""

I get the same error for various json functions. Using the Command Line Processor Plus from Windows 10.

  • Works for me. What client are you using to run the statement? – mustaccio May 30 at 15:38
  • @mustaccio. Edited – Clodoaldo May 30 at 17:33
  • CLPPlus is weird. My guess would be it's doing funny things to quotes. – mustaccio May 30 at 18:03
  • @mustaccio. Also tried from Visual Studio with same error. – Clodoaldo May 30 at 18:15
  • @mustaccio: Server version here is 11.1.4.4. What is yours? – Clodoaldo May 30 at 18:21
1

The problem is that the database must be encoded in UTF-8.

https://developer.ibm.com/articles/sql-json-publishing-functions/

JSON data consists of a sequence of Unicode characters that are arranged in a hierarchical form based on the JSON value syntax and grammar

  • +1 for answering your own question when you found the problem. You should also accept the answers so others easily can see it. – Lennart Jul 27 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.