Sunan an-Nasa'i, Book 35, Hadith 21 (Nasa'i 3810)

'Amr bin Shu'aib narrated from his father, from his grandfather, that the Messenger of Allah said:

"Whoever swears an oath, then sees something better than it, let him do that which is better."