Below is example kind of data. Is there any way to get value only id from below json array.
Env: DB2 query TABLE NAME: RTN_PRD COLUMN NAME : DTL_PRD
{"ProductList":"[{\"ID\":\"1111\",\"Product\":\"A001\"} ,{\"ID\":\"222\",\"Product\":\"A002\"} ,{\"ID\":\"333\",\"Product\":\"A003\"}]"}
I have tried below solution, but error.
SELECT
P.ID_PROD
FROM
RTN_PRD,
JSON_TABLE
( JSON_VALUE ( DTL_PRD,'$.ProductList[*]' )
COLUMNS (
ID_PROD varchar (100) PATH '$.ID')
) P
DB2 for LUW solution.
Using one of the generic UDFs provided here.
The result is: