20 lines
397 B
MySQL
20 lines
397 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_HasUbication`(vTicketFk INT)
|
||
|
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 ;
|