fork download
  1. DELIMITER $$
  2.  
  3. CREATE FUNCTION calculate_f(date1 DATE, date2 DATE, y INT)
  4. RETURNS INT
  5. DETERMINISTIC
  6. BEGIN
  7. DECLARE x INT;
  8. DECLARE result INT;
  9.  
  10. -- Oblicz różnicę dni
  11. SET x = DATEDIFF(date2, date1);
  12.  
  13. -- Oblicz f(x, y)
  14. SET result = (POW(x, 2) - POW(y, 2)) / (x - y);
  15.  
  16. RETURN result;
  17. END$$
  18.  
  19. DELIMITER ;
  20.  
Success #stdin #stdout #stderr 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: near line 1: near "DELIMITER": syntax error
Error: near line 8: near "DECLARE": syntax error
Error: near line 11: near "SET": syntax error
Error: near line 14: near "SET": syntax error
Error: near line 16: near "RETURN": syntax error
Error: near line 17: near "END$$": syntax error