The Mishna (35b) teaches that when the defendant is required to take an oath he is warned that the oath is not his own, but is a biblical requirement made by God and carried out by the court. The Gemara asks why such a warning is necessary, and explains that it is because of kanya d’Rava – Rava’s stick.
The story is told at length in Massekhet Nedarim (25a).
Two people were arguing. One claimed that he had lent money to the other; the second one claimed that the loan had been repaid. Rava ruled that the borrower had to swear that he had repaid the money. The borrower went home, hollowed out a stick, and placed all of the money that he owed into the stick. He returned to the courtroom leaning on the stick and volunteered to hold a sefer Torah and swear that the money had been returned. He asked the lender to hold the stick, ostensibly so that he could hold the Torah. Taking the Torah in his hand he said, “I have returned all of the money that I borrowed from this man; he now has them in his possession.” The lender – knowing that this claim was untrue – became angry and in his anger broke the stick that was in his hand. It then became clear that the oath taken by the borrower was technically true, even though it was an attempt at trickery.
The Ge’onim explain that only in the case of an oath that is required by the Torah would a person hold the Torah in his hands while swearing; in cases where the oath is Rabbinic in nature, there is no need to hold a Torah. Thus, in our case, it would appear that there was no real need for the borrower to hold a Torah while swearing (someone who is a kofer ba-kol – one who denies that he owes anything – is only obligated to swear on a Rabbinic level).
The Meiri explains simply that although he was not personally obligated to hold a sefer Torah in his hands, he wanted to do so, since he needed an excuse to hand the walking stick to the lender.