One of the foundations of Torah morality is the duty to offer protection to the weak and helpless such as widows, orphans, the newcomers within the community, and the dead. These obligations are emphasized because they offer the one who protects the helpless a special opportunity to experience a relationship with God. No direct reward is anticipated from the powerless, for they lack the resources to repay the kindness. Therefore, the reward can only come from God, and such rewards can be expected to derive from the world which is not under the sun. In Biblical code, these duties are often marked by the phrase, "Remember that you were strangers in Egypt, I am the Lord your God." Compare the Babylonian Talmud, Tractate Berachot, p. 19a, and its discussion of the obligation to bury an unclaimed corpse.
All of a person's actions, both good and bad, are motivated by instinctive urges which characterize the world of under the sun. Jealousy can be channeled into the development of great skill, into thievery, into scholarship and perhaps even into philanthropy. However, the perspective of what is done under the sun only sees that these instinctive urges (yetzer ha'rah) are the source of futile and destructive actions, that every good action is contaminated by its venal motivation. However, there is another perspective which recognizes that without jealousy, greed, ambition, or desire for fame, not very much would get done. The urgent pressure of hunger, cold, fear or desire for recognition can also motivate a person to accomplish worthwhile objectives.
The Talmud in the Chapter of Fundamentals (Pirke Avot, 4.1) makes the connection between wisdom and capacity for learning. "Ben Zoma says, 'Who is wise? He who learns from all men,' as it is said, 'From all my teachers I gained wisdom (Psalms 119.99).'" Wisdom is not the accumulation of learning, but the capacity for learning. In this sense, the wisdom of the child may exceed the wisdom of an old king.
The old and foolish king is not cautious because his power has blinded him to the underlying uncertainty of things. Even though he may have access to every pleasure under the sun, he is not so well off as the poor child who is full of potential and capable of learning.
Good derives from limitation, constraint and respecting guidelines. Wickedness is related to unfettered power, arrogance and licentiousness. The paradox of Kohelet is that the beneficial system of guidelines and constraint derives from our relationship with what is beyond our grasp, and not completely demonstrable or self-evident. Hence, the child who has no rigid perception eventually will grow into power, and the ruler who is rigid will eventually cause his kingdom to live in poverty.
The inability to identify with posterity is a defect which is characteristic of living only under the sun. The alienation from ancestors and from succeeding generations results from the narrow focus of getting and spending, for living only under the sun. The first mitzvah in the Torah is to be fruitful and multiply, that is to dedicate our efforts for succeeding generations. Like all of the mitzvot, having and rearing children is a pathway for moving beyond what is under the sun.