Home > database >  Bosses help see me this mysql stored procedures
Bosses help see me this mysql stored procedures

Time:10-01

CREATE PROCEDURE pro_historypath (
Warnid VARCHAR (50),
Type VARCHAR (50)
)
The BEGIN
DECLARE longitude VARCHAR (50);
DECLARE latitude VARCHAR (50);
DECLARE the done int.
DECLARE t_error INT.
The delete from historypath where warmid=warmid and type=type;
If type=0 then
The BEGIN
DECLARE c_historypath CURSOR for the SELECT longitude and latitude from historypath_base ORDER BY id ASC.
DECLARE the CONTINUE HANDLER FOR the NOT FOUND SET done=1;
End

The ELSE
THEN
The BEGIN
DECLARE c_historypath CURSOR for the SELECT longitude and latitude from historypath_base ORDER BY id DESC;
DECLARE the CONTINUE HANDLER FOR the NOT FOUND SET done=1;
END
end if;

The open c_history;

Out_loop: LOOP
The FETCH NEXT FROM c_historypath INTO longitude, latitude;
IF done=1 THEN
LEAVE out_loop;
END the IF;
INSERT into historypath VALUES (UUID (), warmid, longitude, @ latitude, NOW (), type);
COMMIT SLEEP (1) the FETCH FROM c_historypath into longitude and latitude;
End loop out_loop;
The CLOSE c_historypath;
DEALLOCATE c_historypath;
end;

CodePudding user response:

The open c_history; This is wrong!
  • Related