salix/db/routines/srt/procedures/moving_delete.sql

21 lines
556 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `srt`.`moving_delete`(vExpeditionFk INT)
BEGIN
/* Elimina un movimiento
*
* @param vExpeditionFk Identificador de srt.expedition
*
*/
INSERT INTO srt.movingLog(expeditionFk, bufferFromFk, bufferToFk, stateFk, isColliding, movingFk, `action`)
SELECT expeditionFk, bufferFromFk, bufferToFk, stateFk, isColliding, id, 'DELETE'
FROM srt.moving
WHERE expeditionFk = vExpeditionFk;
DELETE FROM srt.moving
WHERE expeditionFk = vExpeditionFk;
END$$
DELIMITER ;