Dear student,
Stomach protects itself from being digested by its own enzymes, or burnt by the corrosive hydrochloric acid, by secreting sticky, neutralising mucus that clings to the stomach walls. If this layer becomes damaged in any way it can result in painful and unpleasant stomach ulcers.
Regards.