Isn't it right to say that ester has a higher oxidation state?
Yes, a C-O:C-H ratio would give you their relative oxidation states.
There's a more general approach that's an extension of oxidation states you from Gen chem [-H --> +1; =O --> -2; -O --> -1; -X (-Cl, -F, -Br, -I) --> -1]. There's a notable exception to these rules...when two of the same elements are bonded to each other. For example, in H
2, each hydrogen as an oxidation state of 0.
Applying this to methane (CH
4), the carbon has an oxidation state of -4, because each H is +1. For ethane (CH
3CH
3), each carbon has an oxidation state of -3, (3 bonds to H = +3, 1 bond to another C = no effect).
In more complicated structures, you can have multiple carbons with different groups attached...you can assign oxidation state to each carbon.