During an endoscopy, a doctor inserts a flexible tube with a light and camera attached to it into the patient's digestive system, according to WebMD. The doctor can then view images of the digestive system on a display.
During an upper endoscopy, a doctor inserts the endoscope into the patient's mouth, according to WebMD. The endoscope passes down the throat and into the esophagus and stomach. By viewing images of these organs, the doctor can check for ulcers or look for other causes of stomach pain.
Before an endoscopy, patients should avoid eating or drinking for six to eight hours, advises WebMD. Doctors usually give patients a sedative to help them relax before the endoscopy. Patients usually experience only minor discomfort during the test, and many sleep through the procedure, according to MedicineNet.