It is narrated, most likely as a marfu’ hadith, from Sayyiduna Ibn Umar (may Allah be pleased with them both) that whoever says “In sha Allah” while taking an oath, then he has the choice: if he wishes to fulfill his oath, he may do so, and if he wishes to retract from it, he may do so without becoming a perjurer.
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 4581