How common is it for children to throw up after having a nightmare?

It is not uncommon. Small children vomits often whenever they are sick, upset, stressed out, or even very tired. I believe that vomiting is a stress reaction, and thus vomiting in small children does not necessarily mean that they have gastrointestinal problems. However recurrent nighmares associated with repetitive vomiting needs to be investigated by a pediatrician to exclude any organic causes.
Nightmares. It is not common, but may be caused by the dreams. Please also have your pediatrician do a full exam and they may consider a sleep study. But be sure your child is not under some severe distress. When bad things happen we are going to have disturbing dreams that could cause the nausea. You can contact me for more information about resolving the nightmares.