
declare
didReserv char(5);
ddateReserv date;
dnb number;
dcpt number:=0;
dtotnb number:=0;
cursor CUR is select idReserv,  count(*)
			from faire
			group by idReserv
			order by 2;
begin
	
		open CUR;
		fetch CUR into didReserv,  dnb;
		while CUR%FOUND
		loop
			select dateReserv into ddateReserv from reservation where idReservation=didReserv;
			insert into tresultat values('Id reservation:'||ddidReserv||' date:'||to_char(ddateReserv,'dd/mm/yy')||' nombre de joueurs:'||to_char(dnb));
			dtotnb:=dtotnb+dnb;
			dcpt:=dcpt+1;
			fetch CUR into didReserv,  dnb;
			end loop;
		end loop;
		close CUR;
		insert into tresultat values('Nombre de joueur moyen par réservation :'||to_char(dtotnb/dcpt));
end;


