The prostatectomy can also be done in a way that tries to save the nerves that surround the prostate. This is known as nerve-sparing prostatectomy. Such a prostatectomy may have better chances at maintaining erectile function. This can only be done if the cancer has not reached the outside of the prostate.