Sometimes covalently-bonded atoms have a share in fewer than 8 electrons e.g. Be in BeCl2, B in BCl3. Be and B have very high ionization energies, and so do not form ionic compounds easily. But, they do not have enough electrons to form sufficient covalent bonds to make an octet.
Semi-stable compounds can be formed if all the available electrons are shared. Atoms with less than a complete octet can readily accept electron pairs to ‘complete their octets’. So, they react easily with other substances which have an electron pair available for forming coordinate bonds.
E.g. BeCl2 + 2Cl– → BeCl42-
Sometimes covalently-bonded atoms have a share in more than 8 electrons.
E.g. P in PCl5 and S in SF6
How can the octet rule be violated? The octet rule arises because s and p orbitals can take up to 8 electrons. However, once we reach the third row of elements in the periodic table we also have d-orbital, and this help take the extra electrons.