Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. DELIMITER $$
  2. CREATE DEFINER=`user_name`@`%` PROCEDURE `sp_TABLE_name`(
  3. pTransType int,
  4. pId bigint,
  5. pName varchar(250),
  6. pStartFrom datetime,
  7. pStartTo datetime,
  8. pSignature longblob)
  9. BEGIN
  10.  
  11. if pTransType = 1 then
  12.  
  13. insert into TABLE_name (Id, Name, startfrom, startto, signature)
  14. values(pId, pName, pStartFrom, pStartTo, pSignature);
  15.  
  16. end if;
  17.  
  18. if pTransType = 2 then
  19.  
  20. update TABLE_name set
  21. Name = pName,
  22. startfrom = pStartFrom,
  23. startto = pStartTo,
  24. signature = pSignature
  25. where Id = pId;
  26.  
  27. end if;
  28.  
  29. if pTransType = 3 then
  30.  
  31. delete from TABLE_name where id = pId;
  32.  
  33. end if;
  34.  
  35. END$$
  36. DELIMITER ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement