Mysql Procedure with an input parameter and output parameter

115
September 28, 2018, at 1:00 PM

I'm trying to Create a procedure named GetOrderItemQuantity with the previous query that takes OrderNumber as an input parameter and the quantity of items for that order as an output parameter.

    DELIMITER $$
USE `mystoredb`$$
DROP PROCEDURE IF EXISTS `GetOrderItemQuantity`$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetOrderItemQuantity`(
IN orderNumber INT (11),
OUT `Items` INT (11)
)
BEGIN
SELECT
o.OrderNumber,
COUNT(oi.*) `Items`
FROM `Order` o 
LEFT JOIN orderItem oi ON o.OrderId = oi.OrderId
WHERE o.OrderNumber = orderNumber
GROUP BY o.OrderNumber;
END$$
DELIMITER ;

For some reason it doesn't seem to be functioning.

Rent Charter Buses Company
READ ALSO
phpMyAdmin doesnt access session variables

phpMyAdmin doesnt access session variables

So when I create a session variable in a query in phpmyadmin like this:

127
How to ignore a column in SQL updates

How to ignore a column in SQL updates

I have a program that looks through a User model and adds values to a prepared update statement if they are not null as follows

131
Select COUNT with inner join

Select COUNT with inner join

I have two tables:

161