salix/db/routines/vn/procedures/travel_checkDates.sql

18 lines
451 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`travel_checkDates`(vShipped DATE, vLanded DATE)
BEGIN
/**
* Checks the landing/shipment dates of travel, throws an error
* ir they are not correct.
*
* @param vShipped The shipment date
* @param vLanded The landing date
*/
IF vLanded < vShipped THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Landing cannot be lesser than shipment';
END IF;
END$$
DELIMITER ;