The invention discloses a traditional Chinese medicine for treating gastric ulcer. The medicine is prepared by the following raw materials by weight: 8-20 parts of Radix Codonopsis, 8-20 parts of Atractylodes macrocephala, 10-25 parts of Chinese yam, 5-15 parts of licorice, 10-20 parts of white hyacinth bean, 10-20 parts of white peony root, 3-10 parts of longan, 10-20 parts of red date, 10-20 parts of rhizoma polygonati, 8-15 parts of polygonatum odoratum, 6-15 parts of catnip, 5-10 parts of pepper, 5-12 parts of dried orange peel, 2-8 parts of Radix Aucklandiae, 3-10 parts of agilawood, 3-10 parts of Nardostachys chinensis Batal, 5-15 parts of millet sprout, 8-15 parts of cuttlebone, 10-25 parts of lotus seed, 5-15 parts of Gorgon fruit, 10-20 parts of pseudo-ginseng, and 15-30 parts ofherba aristolochiae. The traditional Chinese medicine for treating gastric ulcer is formed through scientific compatibility of a plurality of carefully chosen bulk drugs. Effective ingredients of each raw material have mutual influences and synergistic effects so as to play a role in reinforcing spleen and stomach, smoothing the liver and nourishing the blood, stop bleeding and relieving pain, promoting the circulation of qi and dissipating blood stasis, soothing the stagnation of stomach qi, etc. Therefore, the traditional Chinese medicine provided in the invention has very good treatment effects for gastric ulcer patients.