2 Samuel 23:9

And after him was Eleazar the son of Dodo the Ahohite, one of the three mighty men with David, when they defied the Philistines that were there gathered together to battle, and the men of Israel were gone away:

The verse stands in the record of David's mighty men and of the victories gained with David against the Philistines. That record runs alongside praise to God for His goodness and power. All the victory it catalogues is ascribed to Him.

The verse also belongs to the subsequent history of David after his transgression. That history shows the fulfillment of Nathan's denunciation. It sets forth the judgments that followed upon David's sin.