Nocturnal emission
A nocturnal emission is an ejaculation of semen experienced by a male during sleep.  It is also called a "wet dream", an involuntary orgasm, or simply an orgasm during sleep.
Nocturnal emissions are most common during teenage and early adult years. However, nocturnal emissions may happen any time after puberty. They may be accompanied by erotic dreams, and the emission may happen without erection. It is possible to wake up during, or to simply sleep through, the ejaculation in what is sometimes called a "sex dream". Women can also experience orgasms in their sleep.

# Frequency
The frequency of nocturnal emissions is highly variable. Some men have experienced large numbers of nocturnal emissions as teenagers, while others have never experienced one. 83 percent of men in the United States will eventually experience nocturnal emissions at some time in their lives. Surveys in non-western countries where masturbation is culturally suppressed show 98 percent or more of the men eventually experience nocturnal emissions. For males who have experienced nocturnal emissions the mean frequency ranges from 0.36 times per week for single 15 year old males to 0.18 times per week for 40 year old single males. For married males the mean ranges from 0.23 times per week for 19 year old married males to 0.15 times per week for 50 year old married males.
Some have the dreams only at a certain age, while others have them throughout their lives following puberty. The frequency that one has nocturnal emissions has not been conclusively linked to one's frequency of masturbation.  Widely-known sex researcher Alfred Kinsey found "There may be some correlation between the frequencies of masturbation and the frequencies of nocturnal dreams. In general the males who have the highest frequencies of nocturnal emissions may have somewhat lower rates of masturbation. Some of these males credit the frequent emissions to the fact that they do not masturbate; but it is just as likely that the reverse relationship is true, namely, that they do not masturbate because they have frequent emissions." For women the correlation is also short of conclusive; "According to Kinsey's findings, women who suddenly lost the opportunity for several coital orgasms per week had only a few more orgasms in their sleep per year."
One factor that can affect the number of nocturnal emissions a person has is whether they take testosterone-based drugs. In a 1998 study, the number of boys reporting nocturnal emissions drastically increased as their testosterone doses were increased, from 17% of subjects with no treatment to 90% of subjects at a high dose.
During puberty, 13 percent of males experience their first ejaculation as a result of a nocturnal emission. Kinsey found that males experiencing their first ejaculation through a nocturnal emission were older than those experiencing their first ejaculation by means of masturbation. The study indicates that such a first ejaculation resulting from a nocturnal emission was delayed a year or more from what would have been developmentally possible for such males through physical stimulation.
Whereas an ejaculation normally terminates an erection, in the case of nocturnal emission, the subject often still has a functional erection afterward.
Although purported treatments to help prevent or diminish nocturnal emissions are available in abundance, none are known to have undergone any kind of rigorous experimentation or approval process such as that required by the Food and Drug Administration. Like the hiccups, there are a huge variety of "home remedies" with no scientific basis. Moreover, because no proven physical harm (beyond the inconvenience of cleaning the semen ejaculate) is caused by the event and it is not symptomatic of any underlying problem, it is generally considered inadvisable to undergo any sort of treatment.
Involuntary orgasms can occur during waking hours in both sexes, but these are rare.
Regarding women, a 1953 study by Kinsey found that 40% of women experienced at least one orgasm during sleep by the age of 45, and a 1986 study published in the Journal of Sex Research found that 85% of women who have experienced orgasms during sleep first did so at a young age  before the age of 21, and some before 13.

# Spermatorrhoea
In the 18th and 19th century, if a patient had involuntary orgasms frequently or released more semen than is typical, then he was diagnosed with a disease called spermatorrhoea or seminal weakness. A variety of drugs and other treatments, including circumcision and castration, were advised to treat this "disease".  Some modern doctors, especially herb healers, continue to diagnose and advise treatments for cases of spermatorrhoea, but these treatments have not been validated by thorough experimentation.

# Religious views
Saint Augustine held that nocturnal emissions, unlike masturbation, did not pollute the conscience of a man, because they were not voluntary carnal acts, and were therefore not to be considered a sin. Augustine did, however, pray that he may be released from the "glue of lust" and thus recommended the beseechment of God's assistance in clearing one's soul of all such carnal affections.
Some parts of the Bible refer indirectly to nocturnal emission, using the biblical Hebrew term tameh, often translated as impure. For example:
The resulting 'tumah' required the person to bathe in a 'mikveh'. Even a man who had normal intercourse with his wife was considered ceremonially unclean, and he too was required to bathe in a mikveh and he became pure after the sun had set. Leviticus goes on to make similar statements about menstruation and childbirth. Psalms are still recited on Yom Kippur at night as a supposed aid against nocturnal emissions. This is particularly an issue on Yom Kippur, since bathing is forbidden that day.
It is also possible that some of the above is referring to not a discharge of semen but of blood or other substance indicating disease. In fact the Bible lists two different types of emission, one requiring a wait only until the nightfall (nocturnal emission, or intercourse), but the other lasting a week (both requiring bathing in a mikveh). The second type of discharge is a non-normal one (for example pus), indicative of disease. Even the phrase "nocturnal emission" may be a mistranslation of a more dangerous type of emission.
Saint Augustine interprets the references to the uncleanliness of discharge of seed (and menstruation) in Leviticus as symbolising disorder and unruliness as opposed to the seed forming a human being through conception which symbolises the form and structure of a just life.
In medieval Western occultism, nocturnal emissions were believed to be caused by succubus' coupling with the individual at night, an event associated with night terrors.