In addition to sexual arousal, erection can be caused by friction or by the pressure of the filled urinary bladder. In healthy males, erections occur several times per night during sleep, and morning erections when waking up are common. Erections already occur in infant boys.
Physiologically, an erection is achieved by two mechanisms that play together: increased inflow of blood into the vessels of erectile tissue, and decreased outflow. The vessel system involved is known as the corpora cavernosa and the corpus spongiosum. After a signal from the sympathetic nervous system, muscles in the region relax, allowing more blood to enter the sponge-like tissues. Contraction of other muscles reduce the outflow. The enlarged structure then exerts pressures on the exit vein, further reducing the outflow.
As blood flows in, the penis stiffens, its girth and length increases, and it rises to an angle that can vary from horizontal to almost vertical. Normally, the foreskin retracts and exposes the glans.
When the erection mechanism fails to function properly, the result is impotence. Impotence in humans is treated with prosthetic devices, and with prescription drugs. Some prescription drugs are injected directly into the corpus cavernosum or used as urethral suppositories, directly causing erection even in the absence of sexual excitation, while others, such as Viagra, are taken orally and support erection that is due to sexual excitation.
Both an erection and the absence of an erection can be embarrassing, depending on circumstances.
An erection may be embarrassing:
In several countries, movies and magazines available to juveniles may not depict erections; such depictions are often taken as one criterion to distinguish between soft and hard pornography.
Erections may occur even after death, if the pressure within the penis increases for some reason, for example due to the formation of gases of putrefaction.