alex_sem

Untitled

Aug 9th, 2019
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.40 KB | None | 0 0
  1. DELIMITER $$
  2. DROP PROCEDURE IF EXISTS delete_apple_tracks;
  3.  
  4. CREATE PROCEDURE delete_apple_tracks (fileid int)
  5. BEGIN
  6.     DECLARE cnt int default 0;
  7.     REPEAT
  8.         delete from apple where id in (select * from (select id from apple where file_id = fileid limit 10000) as id);
  9.         set cnt = (select count(*) from apple where file_id = fileid);
  10.     UNTIL cnt > 1
  11.     END REPEAT;
  12.  
  13. END$$
  14. DELIMITER ;
Advertisement
Add Comment
Please, Sign In to add comment