Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --26
- CREATE OR REPLACE FUNCTION classementJoueurTournoi(p_idJoueur IN Joueurs.idJoueur%TYPE, p_idTournoi IN Tournois.idTournoi%TYPE) RETURN NUMBER IS
- v_cmp NUMBER;
- BEGIN
- v_cmp := 1;
- FOR v_joueur IN (SELECT DISTINCT idJoueur, nomJoueur, nbPointsJoueurTournoi(idJoueur, idTournoi) AS pts, cumulatifJoueurTournoi(idJoueur, idTournoi) AS cum, performanceEloJoueurTournoi(idJoueur, idTournoi) AS perf
- FROM Joueurs j
- JOIN Parties p ON idJoueurBlancs=idJoueur OR idJoueurNoirs=idJoueur
- WHERE idTournoi = p_idTournoi
- ORDER BY pts DESC, cum DESC, perf DESC, nomJoueur DESC)
- LOOP
- IF v_joueur.idJoueur = p_idJoueur THEN
- RETURN v_cmp;
- END IF;
- v_cmp := v_cmp + 1;
- END LOOP;
- RETURN NULL;
- END;
Advertisement
Add Comment
Please, Sign In to add comment