It can probably be saved. You will want to keep it in a warm dry place - let the base completely dry out - at least 3 days or so, after that check how the base looks and feels - if it is dry and hard then it is probably OK to stick in some soil. If not leave it to dry longer.
Get some really well draining soil put the cactus into the soil maybe up to were the cactus goes from green to yellow or slightly below that. The soil can be a little moist but should not be wet. Do not water for at least a week and then only very sparingly - you do not want that soil to be wet for very long. It takes a while for new roots to develop and until then watering is not really doing anything for the cactus except increasing the chance that it will develop rot and die.
I usually wait with watering until I see new growth, but you can also check occasionally by slightly pulling on the cactus to see if there is any resistance - if there is it has new roots, if not then there will probably not yet much down there.
Keep the cactus warm and in bright light, but not direct sunlight until you see new growth, then you can start exposing it to direct sunlight.
I root a lot of cacti that come off bigger plants and while not 100% successful it is not that far off. As long as the plant does not have rot and the break is dry and calloused over before planting and you are really careful with the water, you have a good shot at success.
Good luck!