What is the cause of black stools with stomach pain?

Black stools can be caused by bleeding from the gastrointestinal tract, including upper and lower gastrointestinal tracts and systemic diseases.
However, black stools need to be ruled out by taking medication, having eaten pork liver, animal blood, etc.