1

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.

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

1 Answer 1

3

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
  • +1 for answering your own question when you found the problem. You should also accept the answers so others easily can see it. Commented Jul 27, 2019 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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