There are other causes of ED,
and you should make sure you are getting enough
exercise and not smoking. Erections require the right nerve impulses and vascular supply, and exercise is good for the vascular system.
If you don't have diabetes, then be assured that Viagra would probably restore your erections if you needed them back. In fact, if you keep your blood sugar down, even with diabetes, Viagra might work, but maybe not as well.
Sorry about your marriage.