Advertisement
kleytonklaus

GetObitosParda

Feb 21st, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.04 KB | None | 0 0
  1. delimiter $$
  2. create function GetObitosParda(obitos_parda varchar(45)) returns varchar (45)
  3. begin
  4.   declare faixa varchar(45);
  5.   if (obitos_parda >= 0 and obitos_parda < 11) then
  6.     set faixa = 'obitos_parda 0 - 11';
  7.   elseif (obitos_parda >= 11 and obitos_parda < 22) then
  8.     set faixa = 'obitos_parda 11 - 22';
  9.   elseif (obitos_parda >= 22 and obitos_parda < 33) then
  10.     set faixa = 'obitos_parda 22 - 33';
  11.   elseif (obitos_parda >= 33 and obitos_parda < 44) then
  12.     set faixa = 'obitos_parda 33 - 44';
  13.   elseif (obitos_parda >= 44 and obitos_parda < 56) then
  14.     set faixa = 'obitos_parda 44 - 56';
  15.   elseif (obitos_parda >= 56 and obitos_parda < 67) then
  16.     set faixa = 'obitos_parda 56 - 67';
  17.   elseif (obitos_parda >= 67 and obitos_parda < 78) then
  18.     set faixa = 'obitos_parda 67 - 78';
  19.   elseif (obitos_parda >= 78 and obitos_parda < 89) then
  20.     set faixa = 'obitos_parda 78 - 89';
  21.   elseif (obitos_parda >= 89 and obitos_parda <= 100) then
  22.     set faixa = 'obitos_parda 89 - 100';
  23.   end if;  
  24.   return faixa;
  25. end $$
  26. delimiter ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement