Reputation: 61
CREATE DEFINER=`root`@`%` PROCEDURE `CountOrderByStatus`(
IN orderStatus VARCHAR(50),
OUT total INT)
BEGIN
SELECT count(orderNumber)
INTO total
FROM orders
WHERE status = orderStatus;
END
This is my stored procedure. I just want to get the out parameter total
's value in my nodejs application
Upvotes: 0
Views: 2055
Reputation: 1206
db_ask.query(("SET @a = 0; CALL CountOrderByStatus('" + _orderStatus + "', @a); SELECT @a;"),function(err, results){
//process result
});
Assuming that db_ask is your connection to mysql db .
Have a nice day, Alex.
Upvotes: 1