Abd al-Rahman bin Samurah (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said: "When you swear an oath upon a good thing (in the narration of Ibn Awn: when you swear an oath about something) and something else is better than it, do the better thing and give the expiation for your oath."
Imam al-Shafi'i (may Allah have mercy on him) said: The saying of Allah, "Let not those of virtue and means among you swear that they will not give to their near relatives" [Surah al-Nur: 22], was revealed about a man who swore that he would not benefit his close relative, and Allah commanded: Benefit him.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الأيمان / 19873