Ver originalBEGIN DECLARE ERROR char;DECLARE validacion char; SET ERROR = 'NOT FOUND DNI'; IF dni_ IN (SELECT DNI FROM Clientes) then SELECT COUNT(Ventas.DNI) FROM Ventas, Clientes WHERE Clientes.DNI = Ventas.DNI AND Clientes.DNI IN (SELECT Clientes.DNI FROM Clientes WHERE Clientes.DNI= dni_) GROUP BY Ventas.DNI; else SELECT ERROR; END IF; END