MySQL Forums
Forum List  »  Spanish

procedimientos
Posted by: Samuel Jesús Checa Contreras
Date: December 15, 2019 01:53PM

Hola a todos me gustaría saber qué error tiene este procedimiento. La cuestion es la siguiente: En una base de datos llamada San Anton se almacenan los participantes de dicha carrera
en este año y los tiempos realizados por dichos corredores. Se desea saber cuál es el
hueco de tiempo más grande entre dos corredores y a poder ser los dorsales de los
corredores.
Y este es mi procedimiento:
DELIMITER $$
create procedure hueco_mayor()
begin
declare salida integer default false;
declare v_tiempo time default 0;
declare cur1 cursor for select a.dorsal, b.dorsal, c.diferencia from
(select dorsal from corredor where dorsal=1)a
join
(select dorsal, tiempo_final from tiempo_carrera where dorsal=3) b
join
(select dorsal, time_format(tiempo_final-tiempo_inicio,'%H:%i:%s') diferencia
from tiempo_carrera) c
group by a.dorsal, c.diferencia;
declare continue handler for not found set salida=true;
open cur1;
fetch cursor1 into v_tiempo;
while(v_tiempo=false)
do
set v_tiemo=true;
end while;
fetch cursor1 into v_tiempo;
close cur1;
select * from san_anton;
drop table san_anton;
end$$
DELIMITER ;

Gracias

Options: ReplyQuote


Subject
Views
Written By
Posted
procedimientos
558
December 15, 2019 01:53PM


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.