Self-consistent electronic structures of MgO and SrO