The Shulchan Aruch · Orach Chayim
אורח חיים רצ״דOrach Chayim 294
Siman 294 of 697 in Orach Chayim — 5 se'ifim
הלכות שבתLaws of Shabbat· siman 294
Se’if 1א׳
אוֹמְרִים הַבְדָּלָה בְּחוֹנֵן הַדַּעַת, וְאִם טָעָה וְלֹא הִבְדִּיל מַשְׁלִים תְּפִלָּתוֹ וְאֵינוֹ חוֹזֵר, מִפְּנֵי שֶׁצָּרִיךְ לְהַבְדִּיל עַל הַכּוֹס. וְאִם טָעַם קֹדֶם שֶׁהִבְדִּיל עַל הַכּוֹס צָרִיךְ לַחֲזֹר וּלְהַבְדִּיל בַּתְּפִלָּה.
The Laws Governing the Recitation of Havdalah in the Shemoneh Esreh, 5 Seifim: We say Havdalah in "He who grants wisdom", and if one erred and did not say Havdalah, he continues his prayers and does not return, since he needs to say havdalah on a cup [of wine]. And if he ate prior to saying havdalah on the cup, he must pray again and recite havdalah in the prayer.
Se’if 2ב׳
טָעָה וְלֹא הִבְדִּיל בַּתְּפִלָּה, וְאֵין לוֹ כּוֹס בַּלַּיְלָה וְסָבוּר שֶׁאַף לְמָחָר לֹא יִהְיֶה לוֹ, צָרִיךְ לַחֲזֹר וּלְהִתְפַּלֵּל.
If one erred and did not say Havdalah in Shmoneh Esrei, and he does not have a cup at night and he believes that even tomorrow he will not have one, must return and pray again.
Se’if 3ג׳
תִּשְׁעָה בְּאָב שֶׁחָל לִהְיוֹת בְּאֶחָד בְּשַׁבָּת, טָעָה וְלֹא הִבְדִּיל בַּתְּפִלָּה אֵינוֹ צָרִיךְ לַחֲזֹר וּלְהִתְפַּלֵּל, כֵּיוָן שֶׁמַּבְדִּיל עַל הַכּוֹס בְּמוֹצָאֵי תִּשְׁעָה בְּאָב.
If one erred and did not mention Havdalah in the Evening Shemoneh Esreh when Tishah BeAv falls on the day after Shabbos, it is not necessary for him to repeat Shmoneh Esrei, because he will say Havdalah over a cup at the conclusion of Tisha B'Av.
Shulchan Aruch, Orach Chayim — Torat Emet 363 edition, via Sefaria — public domain
English: Sefaria Community Translation — CC0