II Samuel 12
"Now therefore, the sword shall never depart from your house, because you have despised Me and have taken the wife of Uriah the Hittite to be your wife" (v10). Tragically, David's sin affected the whole nation. Through the psalms, David expressed his repentant heart, and indeed Nathan the prophet said "The Lord also has taken away your sin" (v13). However, the future was irrevocably changed: there was competition and civil war among David's descendants.
God does not reverse our actions, or their consequences. But His loving power is greater than we imagine, capable of enveloping our worst mistakes.