I wrote a response to a similar question here! https://www.reddit.com/r/AskHistorians/comments/y3rd3j/how_dangerous_was_being_cast_into_the_water_in/
A letter to king Zimri-Lin of Mari (a contemporary of Hammurabi) describes the ordeal taking place to settle what appears to be a property dispute. Two groups of people appeared to have claims on some land and so from the letter 4 people went in the water. The first two women went down and came up "immediately." The third, a man, swam "only" 80 measures, and finally the 4th, another woman, drowned. There were still a few people yet to go but the group abandoned their claim after the drowning (clearly sensing the gods' disapproval given the bad outcomes, especially a death!).
The letter really doesn't say more than that. While informative it's scant on the details! What were their goals in the water? Presumably to swim a certain distance since the man "only" swam 80 measures. This was at the city of Hit, you can look up Hit, Iraq and see the Euphrates is quite wide here - were they just tasked with crossing it? Were they picked at random, given it seems like they were poor swimmers (plenty of people were good swimmers then)? Who set the rules?
In general court evidence in the Ur III period shows that the river ordeal was frequently cancelled - that was a pretty serious escalation and remember, people generally DID believe in the gods and their ability to drown, or save, you. A liar would be hesitant to even swear a false oath, much less invoke the river ordeal, and a false accuser would be worried that the gods would expose their lies. Therefore making people get the gods involved was often enough to resolve a case. I think the same is true in the old Babylonian period.
But it did happen, and the specific details of how it was carried out seem to vary and may have been solely up to a judge or priest and rather ad hoc instead of standardized. There are examples of people being asked to do a difficult task like carrying a heavy stone some distance or swimming a distance entirely underwater. In the most extreme case they could essentially be executions with the person bound - on the other hand sometimes people could actually select someone to stand in for them (and they would obviously pick a strong swimmer) trivializing the actual ordeal.
In the example from the letter this wasn't even a criminal matter, this was a civil dispute. The ordeal itself may not have seemed prohibitively dangerous (they kept going until someone drowned, the letter actually describes them quite upset and frantically saying they'll renounce their claims - they may not have expected someone to die). The whole thing may have been somewhat unusual; it's described in a letter to the king and at the end it mentions the survivors are being sent to the king to be questioned.
Do we have any examples from the Ancient Near East of the river trials in the Laws of Hammurabi actually being out into practice?
Like are there any records outside law codes describing an incident where it was used to solve a dispute?