DELIMITER $$ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`getInfoDelivery`(vRouteFk INT) BEGIN SELECT s.name, s.street, s.city, s.nif, s.postCode FROM vn.route r JOIN vn.agencyMode am ON r.agencyModeFk = am.id JOIN vn.agency a ON am.agencyFk = a.id JOIN vn.supplier s ON a.supplierFk = s.id WHERE r.id = vRouteFk; END$$ DELIMITER ;