Advertisement
costi0n

Untitled

Dec 10th, 2019
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.51 KB | None | 0 0
  1. DROP PROCEDURE LoopDemo;
  2.  
  3. create procedure LoopDemo()
  4.   BEGIN
  5.     DECLARE x INT;
  6.     DECLARE str VARCHAR(255);
  7.     DECLARE tmp_pubb_dal VARCHAR(255);
  8.  
  9.     SET x = 2490;
  10.     SET str =  '';
  11.  
  12.     loop_label:  LOOP
  13.       IF  x > 2501 THEN
  14.         LEAVE  loop_label;
  15.       END  IF;
  16.  
  17.       SET  x = x + 1;
  18.       SELECT pubb_dal into tmp_pubb_dal from N_DETERMINE where numero = `x` and data like '%2019' limit 1;
  19.  
  20.       SET  str = CONCAT(str,tmp_pubb_dal,',');
  21.     END LOOP;
  22.  
  23.     SELECT str;
  24.  
  25.   END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement