Write multiple rows in database from process

Hello,

Is there a way to insert/update multiple rows ( from an array process variable) using "Query Database" or "Stored Procedure" nodes, but without generating one instance for each row to be inserted/updated?

Thank you.

  Discussion posts and replies are publicly visible

Parents
  • Hi oanas,

    I assume you are using MySQL database because you cannot pass an array input to Stored Procedure in MySQL.

    You can convert the data to JSON using a!toJson() and then pass it as a string input to the your Stored Procedure from Execute Stored Procedure Smart Service.

    Parse the JSON String inside your SP and insert/update the result to the respective table.

    You might follow the below link for learning on how to parse JSON in MySQL.
    dev.mysql.com/.../json.html

    This way, it would be just one instance to insert/update multiple rows using SP.

    Thank you,
    Arun
Reply
  • Hi oanas,

    I assume you are using MySQL database because you cannot pass an array input to Stored Procedure in MySQL.

    You can convert the data to JSON using a!toJson() and then pass it as a string input to the your Stored Procedure from Execute Stored Procedure Smart Service.

    Parse the JSON String inside your SP and insert/update the result to the respective table.

    You might follow the below link for learning on how to parse JSON in MySQL.
    dev.mysql.com/.../json.html

    This way, it would be just one instance to insert/update multiple rows using SP.

    Thank you,
    Arun
Children