It depends what kind of ulcer it is.
If it is an aphthous ulcer or "canker" sore, there is not much you can do. They usually last from 10-14 days. There are some over the counter meds apply to the area to temporarily alieve the discomfort. Or it may be an oral herpes
ulcer or "cold" sore. Those sores are usually found around the lips. There are some prescriptions to apply to the sore.