depends on your nationality e g Germany the old passport will only be made invalid at the moment you pick up the new one and they keep the new passport 6 month at embassy before they destroy it if not picked up - so better check with your embassy
Visa will not transferred only the stamps - so if visa is still valid (not sure if you mean your visa is multiple entry or you have a multiple re-entry permit stamp) you need both passports to travel
I was there too because German embassy told me I have to transfer visa to new passport- but after waiting long time at immigration office they siad no transfer possible and they even don’t mentioned anything about stamp transfers - so I also learned it only at the airport:)
No transfer possible keep you old passport visa still valid - just the latest immigration stamp has to be transferred but no need to go to immigration for that when you fly out next time they will ask you to go to a separate counter and they will transfer it ( less than 5 minutes)