1 2 3 4 5 6 7 8 9 10
|
CREATE FUNCTION functionOudin(ANNEE INT)
RETURNS date
DETERMINISTIC
BEGIN
DECLARE G INT;DECLARE C INT;DECLARE B INT;DECLARE C4 INT;DECLARE E INT;DECLARE H INT;DECLARE K INT;DECLARE P INT;DECLARE Q INT;DECLARE I INT;DECLARE J1 INT;DECLARE J2 INT;DECLARE R INT;DECLARE DATEPAQUES DATE;
SET G = ANNEE % 19,C = ANNEE / 100,B = FLOOR((ANNEE / 4) + ANNEE),C4 = C / 4,E = ((8 * C) + 13) / 25,H = ((19 * G) + C - C4 - E + 15) % 30,K = H / 28,K = H / 28,P = 29 / (H + 1),Q = (21 - G) / 11,I = (((K * P * Q) - 1 ) * K) + H,J1 = B + I + 2 + C4 - C,J2 = J1 % 7,R = 28 + I - J2;
SET DATEPAQUES = ADDDATE(CAST(CONCAT(ANNEE, '0301')AS DATE), INTERVAL (R -1) DAY);
RETURN DATEPAQUES;
END |
Partager