I have a problem with knex.js
how to call stored procedure with output in knex.js
sp string : call sp_start(1, @outmsg);
I need call that SP and select the output in return
my code:
.get('/:headerId/recount', function(req, res, next) {
knex.raw(
'Call sp_start(?,?)',[req.params.headerId, @outmsg]
)
.then(function(result) {
return;
});
})
but it return error
According to how to pass in and out parameters to a mysql stored procedure and return the stored procedure result in the nodejs code
knex.transaction(trx => {
return knex.raw(
'Call sp_start(?,@outmsg)',
[req.params.headerId]
)
.then(res => knex.select(knex.raw('@outmsg')));
})
.then(res => console.log("Got output:", res));
should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With