They only hold the dollars for as long as it takes to buy the oil. The transaction probably takes 30 minutes max.
And the amount of time they hold the dollars matters how ? Whether they buy the dollars for a minute or a year they are creating demand for the dollars they purchase. Once they no longer exchange euros for dollars to facilitate their oil transactions, demand for the dollar will drop by the amount they no longer exchange. A drop in demand against a steady or increasing supply of dollars will by economic theory result in a drop in the value of the dollar.