The Prophet ﷺ said, "There is no oath I swear on earth and then see another course to be better than it, except that I take that better course."
أخبرنا قتيبة قال حدثنا ابن أبي عدي عن سليمان عن أبي السليل عن زهدم
عن النبي ﷺ قال ما على الأرض يمين أحلف عليها فأرى غيرها خيرا منها إلا أتيته
Reported by Muslim, Oaths, chapter on the recommendation for one who takes an oath and then sees something better than it, etc., Hadith: 1649/10, from the hadith of Sulayman Taymi. And Bukhari, Distribution of the Fifth, chapter on the evidence that the fifth is for the needs of the Muslims, etc., Hadith: 3133, from the hadith of Zahdam bin Mudarrib, through this same route. It is also found in ... al-Kubra, Hadith: 4720.* Abu Saleel is Dhurayb bin Nuqayr.