The Prophet ﷺ said, "Whoever swears an oath should swear by Allah or remain silent."
أن النبي ﷺ قال: من كان حالفا فليحلف بالله أو ليصمت.
Bukhari narrated it in the Book of Testimonies (2679), and Muslim narrated it in the Book of Oaths and Vows (3:1646), both of them through Nafi, from Ibn Umar, and he mentioned it, and the wording given is that of Bukhari.