Advertisement
kleytonklaus

GetObitosNegros

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