2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`machine_checkPlate`(vPlate VARCHAR(10))
|
2024-01-15 11:31:03 +00:00
|
|
|
RETURNS tinyint(1)
|
|
|
|
NOT DETERMINISTIC
|
|
|
|
READS SQL DATA
|
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Comprueba si existe matrícula
|
|
|
|
*
|
|
|
|
* @param vPlate matrícula del vehículo
|
|
|
|
* @return Devuelve TRUE en caso de que exista
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
IF (SELECT COUNT(*)
|
|
|
|
FROM machine m
|
|
|
|
WHERE m.plate = vPlate
|
|
|
|
) THEN
|
|
|
|
RETURN TRUE;
|
|
|
|
ELSE
|
|
|
|
RETURN FALSE;
|
|
|
|
END IF;
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|