Oxidation state is a formal number because we should use a few rules, sometimes contradictory with our understanding of periodic table and electronegativity.
Only two rules are absolutely valid:
1. Sum of oxidation states is equal to 0 for molecule (or to charge of ion for ion).
2. Oxidation state for elements is always 0.
The other rules based on periodic table and electronegativity are not absolutely valid, so I may found my private rules just for one or more reactions, assuming that rules 1 and 2 are fullfilled.
Usually, For O oxN=-2 and for H OxN=+1 (on the basis of periodic table and electronegativity)
CH3COOH for C OxN=0
CH3CNO for C OxN=+1 (for N oxN=-3 assumed)
CH2CO for C OxN=0
C2H5OH for C Ox=-2
But someone who solves equation, eg:
Cr2P2O7 + I2 = Cr2O3 + CrP3O9 + PI3
using periodic table and electronegativities can be called Master of Oxidation Numbers
With private rules it is almost as easy as C+O2=CO2