Translation:Shulchan Aruch/Orach Chaim/294
294: The Laws of Havdalah in the Shemoneh Esreh. Contains 5 seifim.
1 We say Havdalah in "He Who grants wisdom", and if one erred and did not recite Havdalah, he continues his prayer and does not repeat, since he needs to recite havdalah on the cup. And if he ate before he recited havdalah on the cup, he needs to repeat and recite havdalah in the prayer.
2 One erred and did not recite Havdalah in the prayer, and he does not have a cup at night and he supposes that even tomorrow he will not have – he needs to repeat and to pray.
3 Tishah BeAv that fell to be on a day after Shabbos: One erred and did not recite Havdalah in the prayer – he does not need to repeat and to pray, because he recites Havdalah over the cup at the conclusion of Tisha B'Av.
4 In a situation where they said that one does not repeat to pray, immediately when one finished the blessing, one does not repeat even though he did not begin with the following blessing.
5 In a situation where they said that one does not repeat, if one wanted to be strict on himself to repeat, if he finished his prayer, he is allowed. However, if he has not yet finished his prayer, he is not allowed to repeat.