Having problem in my power supply.

I bought new power supply recently for my p4 computer but when i going to plug in the power cable on it,sometimes it sparking. Me also changed the power cable but sometimes still have same problem,Sometimes it work good but sometimes it spark.
