Hi, I am Dr.Prashanth Marka from Hyderabad. I will try my best to help you. Based on your question it can be due to tooth decay ( cavity). For pain you can take tablets like keterol It requires Root canal treatment followed by capping or extraction and replacement of tooth if its badly damaged. Better you consult a dentist for more help.
Next Steps
It is INFORMATION only, not a substitute for doctor's visit.