2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`vehicle_checkNumberPlate`(vNumberPlate VARCHAR(10), vCountryCodeFk VARCHAR(2))
|
2024-01-15 11:31:03 +00:00
|
|
|
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 ;
|