2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`XDiario_beforeInsert`
|
2024-01-15 11:31:03 +00:00
|
|
|
BEFORE INSERT ON `XDiario`
|
|
|
|
FOR EACH ROW
|
|
|
|
BEGIN
|
|
|
|
IF NEW.SUBCTA <=> '' THEN
|
|
|
|
SET NEW.SUBCTA = NULL;
|
|
|
|
END IF;
|
|
|
|
IF NEW.SUBCTA IS NOT NULL AND NOT LENGTH(NEW.SUBCTA) <=> 10 THEN
|
|
|
|
CALL util.throw('INVALID_STRING_LENGTH');
|
|
|
|
END IF;
|
|
|
|
IF NEW.CONTRA <=> '' THEN
|
|
|
|
SET NEW.CONTRA = NULL;
|
|
|
|
END IF;
|
|
|
|
IF NEW.CONTRA IS NOT NULL AND NOT LENGTH(NEW.CONTRA) <=> 10 THEN
|
|
|
|
CALL util.throw('INVALID_STRING_LENGTH');
|
|
|
|
END IF;
|
|
|
|
CALL XDiario_checkDate(NEW.FECHA);
|
|
|
|
CALL XDiario_checkDate(NEW.FECHA_EX);
|
|
|
|
CALL XDiario_checkDate(NEW.FECHA_OP);
|
|
|
|
CALL XDiario_checkDate(NEW.FECHA_RT);
|
|
|
|
CALL XDiario_checkDate(NEW.FECREGCON);
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|