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`.`ticket_HasUbication`(vTicketFk INT)
|
2024-01-15 11:31:03 +00:00
|
|
|
RETURNS tinyint(1)
|
|
|
|
NOT DETERMINISTIC
|
|
|
|
READS SQL DATA
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
DECLARE hasUbication BOOL;
|
|
|
|
|
|
|
|
SELECT COUNT(*) INTO hasUbication
|
|
|
|
FROM vn.ticket t
|
|
|
|
JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
|
|
|
|
WHERE rm.beachFk
|
|
|
|
AND t.id = vTicketFk;
|
|
|
|
|
|
|
|
RETURN hasUbication;
|
|
|
|
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|