Created
June 21, 2012 09:15
-
-
Save cpamungkas/2964781 to your computer and use it in GitHub Desktop.
Example Trigger Before Insert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER $$ | |
DROP TRIGGER /*!50032 IF EXISTS */ `ujicobadb`.`tr_auto_jual`$$ | |
CREATE | |
/*!50017 DEFINER = 'root'@'localhost' */ | |
TRIGGER `tr_auto_jual` BEFORE INSERT ON `tx_jualan` | |
FOR EACH ROW BEGIN | |
UPDATE tm_produk SET nQtyJual = (nQtyJual - new.nQty) WHERE sIdProduk=new.sIdProdukfk ; | |
END; | |
$$ | |
DELIMITER ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment