DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`expeditionScan_Put`( vPalletFk INT, vExpeditionFk INT ) BEGIN IF NOT EXISTS (SELECT id FROM expeditionPallet WHERE id = vPalletFk) THEN CALL util.throw('Pallet not exists'); END IF; IF NOT EXISTS (SELECT id FROM expedition WHERE id = vExpeditionFk) THEN CALL util.throw('Expedition not exists'); END IF; REPLACE expeditionScan(expeditionFk, palletFk) VALUES(vExpeditionFk, vPalletFk); END$$ DELIMITER ;