Genesis 38:6-10 New Revised Standard Version Catholic Edition (NRSVCE)
6 Judah took a wife for Er his firstborn; her name was Tamar. 7 But Er, Judah’s firstborn, was wicked in the sight of the Lord, and the Lord put him to death. 8 Then Judah said to Onan, “Go in to your brother’s wife and perform the duty of a brother-in-law to her; raise up offspring for your brother.” 9 But since Onan knew that the offspring would not be his, he spilled his semen on the ground whenever he went in to his brother’s wife, so that he would not give offspring to his brother. 10 What he did was displeasing in the sight of the Lord, and he put him to death also.