Ecclesiastes 8:12
10 Not only that, but I have seen the wicked approaching and entering the temple, and as they left the holy temple, they boasted in the city that they had done so. This also is an enigma. 11 When a sentence is not executed at once against a crime, the human heart is full to do evil.47 12 Even though a sinner might commit a hundred crimes and still live a long time, yet I know that it will go well with God-fearing people—for they stand in fear before him. 13 But it will not go well with the wicked, nor will they prolong their days like a shadow, because they do not stand in fear before God.
Ecclesiastes 8:14
13 But it will not go well with the wicked, nor will they prolong their days like a shadow, because they do not stand in fear before God. 14 Here is another enigma that occurs on earth: Sometimes there are righteous people who get what the wicked deserve, and sometimes there are wicked people who get what the righteous deserve. I said, “This also is an enigma.” 15 So I recommend the enjoyment of life, for there is nothing better on earth for a person to do except to eat, drink, and enjoy life. So joy will accompany him in his toil during the days of his life that God gives him on earth.
Notes and References
"... Qohelet both affirms divine justice and complains of the injustices that God allows. The contradiction is most blatant in 8:10-14, where Qohelet says that the righteous live long and the wicked die young (8:12-13) and that the opposite sometimes occurs (8:10-12 + 14). The techniques for eliminating contradictions have been exercised most vigorously on Qohelet's statements on justice. Inconsistencies have been harmonized and various sentences tagged as orthodox glosses or quotations. But this contradiction appears too often, too prominently, and too well-integrated into context to be convincingly harmonized. The addition-hypothesis requires deciding in advance that Qohelet believes one side or the other of the contradiction, though both are well represented. And it is equally arbitrary to identify one opinion as a quotation, for nothing in the passages at issue attributes one of the contradictory ideas to another voice ..."
Fox, Michael V. Qohelet and His Contradictions (p. 121) Almond Press, 1989