How can I insert multiple records in a single stored procedure?

0

Hello, how are all my questions? Is it possible to send a stored procedure in this way:

CALL SP_CLIENTE((1,'pepito','perez'),(2,'alan','brito'));

for (let i = 0; i < xml.length; i++) {
    datosJSON.push({
       'id': info.replace(xml[i]['id']['_'], '404'),
       'nombre': info.replace(xml[i]['nombre']['_'], 'N/A'),
       'apellido': info.replace(xml[i]['apellido']['_'], 'N/A')
    });

    var conditions = [
      info.vNull(datosJSON[i].id),
      info.vNull(datosJSON[i].nombre),
      info.vNull(datosJSON[i].apellido),
    ];
                                               
    connection.query('call sp_insert_datos(?,?,?)', conditions, function (error, results, fields) {
        connection.release();
        if (error) {
            throw error;
        } else {
            console.log("Datos Migrados");

        }
    });
}

This way I have it so that every time I go through the cycle I push it and add it to JSON data and after that I pass it to conditions that are the parameters that it sent to the stored procedure

    
asked by Jeffry Jose Barrios Gomez 06.06.2018 в 18:45
source

0 answers