Erectile dysfunction: Viagra and other oral medications. Oral medications are often the first line of treatment for erectile dysfunction. For most men who have trouble keeping an erection firm enough for sex (erectile dysfunction), these medications work well and cause few side effects.or most men who have trouble keeping an erection firm enough for sex (erectile dysfunction), these medications work well and cause few side effects.