Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 6th, 2018 61 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. /*
  2. **************************************************************************************
  3.                 UTS MBD 17FX
  4.  
  5. FIRLI AFRISA (17312296)
  6. KHOLID AINI   (17312261)
  7.  
  8.                  INFORMATIKA 17 FX
  9. **************************************************************************************
  10.  
  11. */
  12.  
  13.  
  14. /*TRIGGER NO HP DAN NAMA
  15. */
  16. DELIMITER $$
  17.  
  18. USE `securitypractice`$$
  19.  
  20. DROP TRIGGER /*!50032 IF EXISTS */ `b_insert-nohp&&ceknama`$$
  21.  
  22. CREATE
  23.     /*!50017 DEFINER = 'root'@'localhost' */
  24.     TRIGGER `b_insert-nohp&&ceknama` BEFORE INSERT ON `employee`
  25.     FOR EACH ROW BEGIN
  26.    
  27. /*kondisi nomor hp <10 atau >12 st*/
  28.     IF(LENGTH(new.epe_noHape) <10 OR LENGTH(new.epe_noHape) > 12) THEN
  29.     SET NEW.epe_noHape=NULL;
  30.     END IF;
  31.    
  32. /*kondisi awalan st*/
  33.     IF(SUBSTRING(new.epe_name,1,2) = "st") THEN
  34.     INSERT INTO audit_employee
  35.     SET audit_employee.epe_oldName = CONCAT(SUBSTRING(new.epe_name,1,2),SUBSTRING(new.epe_name,3)),
  36.     audit_employee.epe_newName = CONCAT("Siti",SUBSTRING(new.epe_name,3)),
  37.     new.epe_name =CONCAT("Siti",SUBSTRING(new.epe_name,3)),
  38.     audit_employee.epe_nik  = new.epe_nik,
  39.     audit_employee.aee_action ="Updates",
  40.     audit_employee.aee_chDate = NOW();
  41.     END IF;
  42.    
  43.    
  44. /*kondisi awalan a or a.*/
  45.      
  46.     IF(SUBSTRING(new.epe_name,1,2) = "a " OR SUBSTRING(new.epe_name,1,2) = "a." ) THEN
  47.     INSERT INTO audit_employee
  48.     SET audit_employee.epe_oldName = CONCAT(SUBSTRING(new.epe_name,1,2),SUBSTRING(new.epe_name,3)),
  49.     audit_employee.epe_newName = CONCAT("Abdul", SUBSTRING(new.epe_name,3)),
  50.     new.epe_name =CONCAT("Abdul", SUBSTRING(new.epe_name,3)),
  51.     audit_employee.epe_nik  = new.epe_nik,
  52.     audit_employee.aee_action ="Updates",
  53.     audit_employee.aee_chDate = NOW();
  54.     END IF;
  55.    
  56. /*===========================kondisi awalan m atau m. dan muh atau muh.===============================*/
  57.     IF(SUBSTRING(new.epe_name,1,2) = "m " OR SUBSTRING(new.epe_name,1,2) = "m." ) THEN
  58.     INSERT INTO audit_employee
  59.     SET audit_employee.epe_oldName = CONCAT(SUBSTRING(new.epe_name,1,2),SUBSTRING(new.epe_name,3)),
  60.     audit_employee.epe_newName = CONCAT("Muhammad", SUBSTRING(new.epe_name,3)),
  61.     new.epe_name =CONCAT("Muhammad", SUBSTRING(new.epe_name,3)),
  62.     audit_employee.epe_nik  = new.epe_nik,
  63.     audit_employee.aee_action ="Updates",
  64.     audit_employee.aee_chDate = NOW();
  65.     END IF;
  66.    
  67.     IF(SUBSTRING(new.epe_name,1,4) = "muh " OR SUBSTRING(new.epe_name,1,4) = "muh." ) THEN
  68.     INSERT INTO audit_employee
  69.     SET audit_employee.epe_oldName = CONCAT(SUBSTRING(new.epe_name,1,4),SUBSTRING(new.epe_name,5)),
  70.     audit_employee.epe_newName = CONCAT("Muhammad", SUBSTRING(new.epe_name,5)),
  71.     new.epe_name =CONCAT("Muhammad", SUBSTRING(new.epe_name,5)),
  72.     audit_employee.epe_nik  = new.epe_nik,
  73.     audit_employee.aee_action ="Updates",
  74.     audit_employee.aee_chDate = NOW();
  75.     END IF;    
  76.    
  77.         /*
  78.     IF(SUBSTRING(new.epe_name,1,4) = "abd " OR SUBSTRING(new.epe_name,1,4) = "abd." ) THEN
  79.     SET new.epe_name = CONCAT("Abdul",SUBSTRING(new.epe_name,5));
  80.     END IF;*/
  81.     END;
  82. $$
  83.  
  84. DELIMITER ;
  85.  
  86. /*INPUT KE TABEL EMPLOYEE*/
  87.  
  88. INSERT INTO `securitypractice`.`employee` (
  89.   `epe_nik`,
  90.   `epe_name`,
  91.   `epe_tglLahir`,
  92.   `epe_tglGabung`,
  93.   `epe_noHape`,
  94.   `usr_id`
  95. )
  96. VALUES
  97.   (
  98.     '324568',
  99.     'Hadi Gusnanto',
  100.     '1989-02-03',
  101.     '2012-12-15',
  102.     '0821382784',
  103.     '25638'
  104.   ),
  105.   (
  106.     '324569',
  107.     'M. Solihin',
  108.     '1993-07-24',
  109.     '2011-05-13',
  110.     '085827186378',
  111.     '45372'
  112.   );
  113.  
  114. /*MEMBERIKAN AKSES INACTIVE PADA BUDI SETIAWAN*/
  115. UPDATE usertab SET `usr_status`="INACTIVE",`usr_statusDate`="2018-02-08" WHERE `usr_name`="Budi Setiawan"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top