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

18 lines
449 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`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 ;