salix/db/routines/stock/procedures/visible_log.sql

21 lines
401 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `stock`.`visible_log`(
vIsPicked BOOL,
vWarehouseFk INT,
vItemFk INT,
vQuantity INT
)
proc: BEGIN
IF !vIsPicked THEN
LEAVE proc;
END IF;
INSERT INTO visible
SET itemFk = vItemFk,
warehouseFk = vWarehouseFk,
quantity = vQuantity
ON DUPLICATE KEY UPDATE
quantity = quantity + VALUES(quantity);
END$$
DELIMITER ;