18 lines
571 B
SQL
18 lines
571 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`vehicle_checkNumberPlate`(vNumberPlate VARCHAR(10), vCountryCodeFk VARCHAR(2))
|
|
BEGIN
|
|
/**
|
|
* Comprueba si la matricula pasada tiene el formato correcto dependiendo del pais del vehiculo
|
|
*/
|
|
DECLARE vRegex VARCHAR(45);
|
|
|
|
SELECT vp.regex INTO vRegex
|
|
FROM vehiclePlateRegex vp
|
|
WHERE vp.countryCodeFk = vCountryCodeFk;
|
|
|
|
IF NOT vNumberPlate REGEXP BINARY (vRegex)THEN
|
|
CALL util.throw(CONCAT('Error: la matricula ', vNumberPlate, ' no es valida para ',vCountryCodeFk));
|
|
END IF;
|
|
END$$
|
|
DELIMITER ;
|