22 lines
463 B
SQL
22 lines
463 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `bs`.`tramo`(vDateTime DATETIME)
|
|
RETURNS varchar(20) CHARSET utf8mb3 COLLATE utf8mb3_unicode_ci
|
|
NOT DETERMINISTIC
|
|
NO SQL
|
|
BEGIN
|
|
|
|
DECLARE vTramo VARCHAR(20);
|
|
DECLARE vHour INT;
|
|
|
|
SET vHour = HOUR(vDateTime) ;
|
|
|
|
SET vTramo =
|
|
CASE
|
|
WHEN vHour BETWEEN 0 AND 14 THEN 'Mañana'
|
|
WHEN vHour BETWEEN 15 AND 24 THEN 'Tarde'
|
|
END ;
|
|
|
|
RETURN vTramo;
|
|
END$$
|
|
DELIMITER ;
|