2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`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 ;
|