PRIAPISM (prolonged erection): 

(Priapism is an EMERGENCY...consult urologist after 3-4 hours of erection urgently)

Priapism is a condition in which a penis remains erect for hours in the absence of stimulation or after stimulation has ended.

There are three types: ischemic (low-flow), nonischemic (high-flow), and recurrent ischemic (intermittent).

Most cases are ischemic.
 Ischemic priapism is generally painful while nonischemic priapism is not.

 In ischemic priapism most of the penis is hard; however, the glans penis is not.

 In nonischemic priapism the entire penis is only somewhat hard.

CAUSES: 

Priapism can also be caused by reactions to medications. 

The most common medications that cause priapism are intra-cavernous injections for treatment of erectile dysfunction (papaverine, alprostadil). 

Other groups reported are antihypertensives, antipsychotics (e.g., chlorpromazine, clozapine), antidepressants (most notably trazodone), anti-convulsant and mood stabilizer drugs such as sodium valproate, anticoagulants, cantharides (Spanish Fly) and recreational drugs 
(ALCOHOL, HEROINE and COCAINE). 

TREATMENT:

Treatment depends on the type.

Ischemic priapism is typically treated with a nerve block of the penis followed by aspiration of blood from the corpora cavernosa.
 If this is not sufficient the corpus cavernosum may be irrigated with cold normal saline or injected with phenylephrine.

 Nonischemic priapism is often treated with cold packs and compression.

 Surgery may be done if usual measures are not effective.

 In ischemic priapism the risk of permanent scarring/ erectile dysfunction of the penis begins to increase after 4 hours and definitely occurs after 48 hours

For more details click here