LOOP to delet by block.
Hello,
I am trying create a MYSQL script that delete many rows of a big table.
I do not know why this doesn´t works
I am trying command of mysql oficial guide and other web examples..
Please, help me:
---------
SELECT COUNT(id) FROM traccaroficial.tc_events WHERE serverTime < DATE_ADD(NOW(), INTERVAL -30 DAY) INTO @Quantidade_Total_De_Registro ;
BEGIN
if ( @Quantidade_Total_De_Registro >0 ) then
DELETE FROM traccaroficial.tc_events WHERE serverTime < DATE_ADD(NOW(), INTERVAL -30 DAY) limit 1000
@Quantidade_Total_De_Registro = @Quantidade_Total_De_Registro - 1000;
else
LEAVE sp
END if
END
------
the error is:
sql syntax near ps:begin
Subject
Written By
Posted
LOOP to delet by block.
February 03, 2021 10:01PM
February 04, 2021 05:34AM
February 08, 2021 11:31PM
February 04, 2021 12:09PM
February 04, 2021 07:08PM
February 04, 2021 07:58PM
Sorry, you can't reply to this topic. It has been closed.
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.