This file contains 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
CREATE DEFINER = CURRENT_USER TRIGGER `veeva_new`.`account_au` AFTER UPDATE ON `account` FOR EACH ROW | |
BEGIN | |
SET @TargetLastMod=(SELECT targets.lastSyncAt FROM pdone.targets WHERE targets.veeva_account_id=NEW.id LIMIT 0,1); | |
# [ IF EXISTS IN pdone.targets, UPDATE only if NEW.lastmodifieddate IS GREATER than @TargetLastMod ] | |
IF (NEW.lastmodifieddate > @TargetLastMod) THEN | |
INSERT INTO pdone.targets | |
(`veeva_account_id`,`veeva_timestamp`,`display_name`,`avatar_url`,`title`,`first`,`last`,`suffix`,`address1`,`address2`,`city`,`state`,`zip`,`phone`,`fax`,`target_type`,`npi`,`inactive`,`lastSyncAt`,`createdAt`,`updatedAt`) | |
SELECT | |
account.id AS veeva_account_id, | |
account.lastmodifieddate AS veeva_timestamp, |
This file contains 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
USE `veeva_new`; | |
DELIMITER $$ | |
DROP TRIGGER IF EXISTS veeva_new.address_vod__c_ai$$ | |
USE `veeva_new`$$ | |
CREATE DEFINER=`root`@`localhost` TRIGGER `veeva_new`.`address_vod__c_ai` AFTER INSERT ON `address_vod__c` FOR EACH ROW | |
BEGIN | |
DECLARE vCount INT(6) DEFAULT 0; | |
SET vCount=(SELECT COUNT(*) FROM pdone.targets WHERE targets.veeva_account_id=NEW.account_vod__c); |
This file contains 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
mysql> CALL GetVoteID(1,1,@votes_id); | |
Query OK, 1 row affected (0.00 sec) | |
mysql> SELECT @votes_id votes_id; | |
+----------+ | |
| votes_id | | |
+----------+ | |
| 5 | | |
+----------+ | |
1 row in set (0.00 sec) |
OlderNewer