Preparation of carboxylic acid esters by oxidation of groups which are precursors for the acid moiety of the ester by oxidation of secondary alcohols or ketones