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.user_au$$ | |
USE `veeva_new`$$ | |
CREATE DEFINER=`root`@`%` TRIGGER `veeva_new`.`user_au` AFTER UPDATE ON `user` FOR EACH ROW | |
BEGIN | |
SET @UserVerification=(select reps.veeva_rep_id from pdone.reps where reps.veeva_rep_id=OLD.id); | |
IF (@UserVerification>0) then |
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.user_ai$$ | |
USE `veeva_new`$$ | |
CREATE DEFINER = CURRENT_USER TRIGGER `veeva_new`.`user_ai` AFTER INSERT ON `user` FOR EACH ROW | |
BEGIN | |
INSERT INTO pdone.reps | |
(veeva_rep_id,territories_id,display_name,avatar_url,rep_type,username,first,last,title,bio,phone,email,inactive,lastLoginAt,lastSyncAt,repTokenId,createdAt,updatedAt) |
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
DECLARE E INT DEFAULT 0; | |
DECLARE M TEXT DEFAULT NULL; | |
DECLARE CONTINUE HANDLER FOR 1000 SET E='1000', M="hashchk"; | |
DECLARE CONTINUE HANDLER FOR 1001 SET E='1001', M="isamchk"; | |
DECLARE CONTINUE HANDLER FOR 1002 SET E='1002', M="NO"; | |
DECLARE CONTINUE HANDLER FOR 1003 SET E='1003', M="YES"; | |
DECLARE CONTINUE HANDLER FOR 1004 SET E='1004', M="Can't create file '%s' (errno: %d)"; | |
DECLARE CONTINUE HANDLER FOR 1005 SET E='1005', M="Can't create table '%s' (errno: %d)"; | |
DECLARE CONTINUE HANDLER FOR 1006 SET E='1006', M="Can't create database '%s' (errno: %d)"; |
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=`root`@`localhost` TRIGGER `veeva_new`.`userterritory_ai` AFTER INSERT ON `userterritory` FOR EACH ROW | |
BEGIN | |
# [ VARIABLES DECLARATION ] | |
DECLARE vUserID VARCHAR(18) DEFAULT ''; | |
DECLARE vTerritoryRep VARCHAR(45) DEFAULT ''; | |
DECLARE vTerritoryLastMod DATETIME DEFAULT '0000-00-00 00:00:00'; | |
DECLARE vTerritoryCount INT(7) DEFAULT 0; #[060715.01] | |
# [ VARIABLES ASIGNATION ] | |
SET vUserID =NEW.userid; | |
SET vTerritoryRep =(select IFNULL(reps.territories_id,'N/A') from pdone.reps where reps.veeva_rep_id=vUserID LIMIT 0,1); |
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=`root`@`localhost` TRIGGER `veeva_new`.`userterritory_ai` AFTER INSERT ON `userterritory` FOR EACH ROW | |
BEGIN | |
# [ VARIABLES DECLARATION ] | |
DECLARE vUserID VARCHAR(18) DEFAULT ''; | |
DECLARE vTerritoryRep VARCHAR(45) DEFAULT ''; | |
DECLARE vTerritoryLastMod DATETIME DEFAULT '0000-00-00 00:00:00'; | |
DECLARE vTerritoryCount INT(7) DEFAULT 0; #[060715.01] | |
# [ VARIABLES ASIGNATION ] | |
SET vUserID =NEW.userid; | |
SET vTerritoryRep =(select IFNULL(reps.territories_id,'N/A') from pdone.reps where reps.veeva_rep_id=vUserID LIMIT 0,1); |
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.userterritory_ai$$ | |
USE `veeva_new`$$ | |
CREATE DEFINER=`root`@`localhost` TRIGGER `veeva_new`.`userterritory_ai` AFTER INSERT ON `userterritory` FOR EACH ROW | |
BEGIN | |
# [ VARIABLES DECLARATION ] | |
DECLARE vUserID VARCHAR(18) DEFAULT ''; |
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=`root`@`localhost` TRIGGER `veeva_new`.`userterritory_ai` AFTER INSERT ON `userterritory` FOR EACH ROW | |
BEGIN | |
# [ VARIABLES DECLARATION ] | |
DECLARE vUserID VARCHAR(18) DEFAULT ''; | |
DECLARE vTerritoryRep VARCHAR(45) DEFAULT ''; | |
DECLARE vTerritoryLastMod DATETIME DEFAULT '0000-00-00 00:00:00'; | |
DECLARE vTerritoryCount INT(7) DEFAULT 0; #[060715.01] | |
# [ VARIABLES ASIGNATION ] | |
SET vUserID =NEW.userid; | |
SET vTerritoryRep =(SELECT IFNULL(reps.territories_id,'N/A') FROM pdone.reps WHERE reps.veeva_rep_id=vUserID LIMIT 0,1); |
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 $$ | |
CREATE DEFINER=`root`@`localhost` TRIGGER `veeva_new`.`userterritory_ai` AFTER INSERT ON `userterritory` FOR EACH ROW | |
BEGIN | |
# [ VARIABLES DECLARATION ] | |
DECLARE vUserID VARCHAR(18) DEFAULT ''; | |
DECLARE vTerritoryRep VARCHAR(45) DEFAULT ''; | |
DECLARE vTerritoryLastMod DATETIME DEFAULT '0000-00-00 00:00:00'; | |
DECLARE vTerritoryCount INT(7) DEFAULT 0; #[060715.01] | |
# [ VARIABLES ASIGNATION ] |
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 `PRUEBA`; | |
DROP function IF EXISTS `alpha`; | |
DELIMITER $$ | |
USE `PRUEBA`$$ | |
CREATE DEFINER=`root`@`localhost` FUNCTION `alpha`( | |
vStr CHAR(75)) RETURNS char(32) CHARSET latin1 | |
BEGIN | |
DECLARE vInd, vLen SMALLINT DEFAULT 1; | |
DECLARE vReturn CHAR(32) DEFAULT ''; |
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.account_ai$$ | |
USE `veeva_new`$$ | |
CREATE DEFINER = CURRENT_USER TRIGGER `veeva_new`.`account_ai` AFTER INSERT ON `account` FOR EACH ROW | |
BEGIN | |
DECLARE vCount INT(6) DEFAULT 0; | |
OlderNewer