I have an inverter works on AC mains and has battery charger inbuilt. I have solar panels with a charge controller. Can I connect both power sources wires to battery terminals in parallel. So In case of power interruption, battery could charge using solar.
With your title, you just described the usual motorhome setup. Solar, AC charger and inverter all connected to a battery.
So yes, it is possible and a lot of people do.
Then again, it is up to you to match the both chargers, the battery, the inverter and the load together. Failing to match and connect them properly can result in anything in between poor performance, fire or personal injury.
And, if I have solar power, I would like the battery charged by the solar first and to use AC only when the solar power is not available or not enough.
AC power costs money, solar power is for free.