-1

I'm trying to pass an array of JSON objects to the Stored procedure, so that each JSON object will be stored in a single row of the table.

for an example: to insert a single entry: INSERT INTO SCHEMA_NAME.TABLE_NAME (id,name) values (1,'my_name')

now i have an array of such data which I want to push into stored procedure to get all data inserted into table without hitting SP again and again.

array example: [{id:1,name:'name1'},{id:2,name:'name2'}]

now i can have number of object to be stored.

so either i would hit the SP again and again to push each object individually or i would pass whole array and run a loop inside a stored procedure to get it done.

I have DB2 10.5 LUW with fixpack 7 installed and using node.js

user2881430
  • 367
  • 1
  • 5
  • 17

1 Answers1

0

DB2 10.5 does not support JSON as a native data type, so you won't be able to do this without passing the JSON as a VARCHAR and having the stored procedure parse/deconstruct the JSON. The obvious way to do this would with a C or Java stored procedure.

That said, there are some JSON capabilities (see this series of articles for more details, but this is almost certainly not what you want.

Ian Bjorhovde
  • 10,916
  • 1
  • 28
  • 25