DB2 11.1.4.4 – Error Trying a Manual’s Example

db2db2-luwfunctionsjson

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.

Best Answer

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