DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `srt`.`buffer_giveBack`(vSelf INT) BEGIN /* Devuelve una caja al celluveyor * * * @param vSelf Identificador de srt.buffer */ DECLARE vExpeditionFk INT; SELECT e.id INTO vExpeditionFk FROM srt.expedition e WHERE e.bufferFk = vSelf ORDER BY e.`position` LIMIT 1; IF vExpeditionFk THEN CALL srt.expedition_relocate(vExpeditionFk, srt.buffer_get(vExpeditionFk)); END IF; END$$ DELIMITER ;