That the Prophet (ﷺ) said: "Whoever takes an oath, and then he sees that something else is better than it, then he should make atonement for his oath and then do it."
Jami` at-Tirmidhi Book 20, Hadith 8