Advertisement
kleytonklaus

GetEsgotamentoSanitario

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