funcion mysql

Llevo tiempo sin escribir funciones yahora no se porque esta me da un error de de sintaxis a ver alguien me puede echar una mano

create function prueba(id integer(5)) returns decimal(10,2)
  BEGIN
      declare sumatorio decimal(10,2);
      declare idpres integer(5);
     idpres:=id;
     select sum(base) into sumatorio from presupuestos where idpresupuesto=id;
    return sumatorio;
END;
0 respuestas