Stomachache, like headache, is a countable noun in American English. In American English we almost always use a determiner (article, demonstrative pronoun, possessive pronoun) before count nouns such as these two words. And also before 'upset stomach', which is also commonly used.
There is also 'bellyache', but this is informal. In fact, 'bellyache' can be used as a verb, meaning 'to complain.' This is also informal.
In British English, it is spelled 'stomach ache' and is a mass noun.