Sensex ends flat; tech stocks gain, ONGC falls