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

20 lines
487 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `stock`.`log_delete`(vTableName VARCHAR(255), vTableId INT)
proc: BEGIN
/**
* Processes orphan transactions.
*/
IF vTableName NOT IN ('buy', 'sale', 'orderRow') THEN
LEAVE proc;
END IF;
DELETE FROM inbound
WHERE tableName = vTableName COLLATE utf8_general_ci
AND tableId = vTableId;
DELETE FROM outbound
WHERE tableName = vTableName COLLATE utf8_general_ci
AND tableId = vTableId;
END$$
DELIMITER ;