NEW YORK—Oil prices erased losses to settle higher Wednesday after U.S. inventory data showed that crude-oil stockpiles rose to another record high last week but that supplies of refined products such as gasoline fell.

Light, sweet crude for April delivery settled up 28 cents, or 0.9% to $32.15 a barrel on the New York Mercantile Exchange. Brent, the global benchmark, rose $1.14, or 3.4%, to $34.41 a barrel on ICE Futures Europe.

...