Catalyzes the NAD(P)(+)-dependent oxidation of alpha-ketoglutaric semialdehyde (alphaKGSA) to alpha-ketoglutarate. Involved in hydroxy-L-proline metabolism. Prefers NADP(+) to NAD(+) as a cosubstrate. 2,5-dioxopentanoate + H2O + NADP(+) = 2-oxoglutarate + 2 H(+) + NADPH 2,5-dioxopentanoate + H2O + NAD(+) = 2-oxoglutarate + 2 H(+) + NADH kcat is 21.3 sec(-1) with alpha-ketoglutaric semialdehyde as substrate (in the presence of NAD(+)). kcat is 23.0 sec(-1) with alpha-ketoglutaric semialdehyde as substrate (in the presence of NADP(+)). Amino-acid degradation. Homodimer. Induced by hydroxy-L-proline. Belongs to the aldehyde dehydrogenase family.