MySQL Forums
Forum List  »  Triggers

Re: Validation Trigger
Posted by: Oliver Taylor
Date: December 15, 2010 03:24PM

Ok thanks,

Where would that go?
If I used the SIGNAL rule would I use it inside the trigger?

Something like this:
-- Trigger DDL Statements
DELIMITER $$

USE `spikes`$$

CREATE
DEFINER=`root`@`localhost`
TRIGGER `spikes`.`trigger1`
BEFORE INSERT ON `spikes`.`invoice_details`
FOR EACH ROW
BEGIN
IF NEW.due_date <= NOW() OR NEW.invoice_date <= NOW() OR NEW.shipping_total <=0 OR NEW.order_total <=0 OR NEW.total_cost <=0 THEN
CALL raise_application_error(1234, 'Error - check Date and value');
SIGNAL WARN
SET MESSAGE_TEXT = 'CHECK VAlUE';
END IF;
END$$

Is there any specific syntax?
Also does SIGNAL "" have to be any specific filed?

Options: ReplyQuote


Subject
Views
Written By
Posted
5407
December 15, 2010 11:29AM
1748
December 15, 2010 12:06PM
1627
December 15, 2010 12:29PM
1529
December 15, 2010 01:04PM
1574
December 15, 2010 01:49PM
1351
December 15, 2010 02:43PM
Re: Validation Trigger
1577
December 15, 2010 03:24PM
1523
December 16, 2010 07:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.