MySQL Forums
Forum List  »  General

Re: LOOP to delet by block.
Posted by: Peter Brawley
Date: February 04, 2021 07:58PM

drop table if exists t;
create table t(i int);
insert into t values(1),(2),(3),(4),(5);
select * from t;
drop procedure if exists p;
delimiter go
create procedure p()
begin
  repeat
    delete from t limit 2;
  until row_count() < 1 end repeat;
end;
go
delimiter ;
go
call p();
select * from t;

Possibly try harder?

Options: ReplyQuote


Subject
Written By
Posted
February 03, 2021 10:01PM
February 08, 2021 11:31PM
February 04, 2021 12:09PM
Re: LOOP to delet by block.
February 04, 2021 07:58PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.