The Oracle said that the eighth son of Devaki would kill Kansa, then why did he kill seven sons?
The reason was the fear and insecurity created in Kamsa's mind after meeting with sage Narada.
After hearing a prophecy by an unembodied voice (Akash vani. It was not by a sage) that eighth son of Devakī would kill him, Kamsa was shocked and decided to kill his sister Devakī. But he has changed his mind after hearing words of Vasudeva. Vasudeva made an agreement that he would bring all his children to Kamsa as soon as they are born. In this way, he thought of saving life of his wife. Kamsa has agreed with this and spared the life of Devakī. They were not even put in jail and let them live in their own house.
When first child was born, Vasudeva took him to Kamsa according to their agreement. But Kamsa was happy to see the baby. He did not harm him and said to Vasudeva
O Vasudeva, you may take back your child and go home. I have no fear of your first child. It is the eighth child of you and Devakī I am concerned with because that is the child by whom I am destined to be killed.
Vasudeva happily took back his first born son to home. But the situation changed when Narada muni has once arrived to Kamsa's place and informed him about Yadu dynasty and inhabitants of Vridavana. He informed how demons incarnated on the earth and how the devatas have took their birth as inhabitants of Vrindavana to help Vishnu to kill the demons. Listening to this, Kamsa has changed his mind. He had decided to kill each and every child born of Devakī's womb out of fear doubting it was Vishnu who has incarnated to kill him.
After the departure of the great saint Nārada, Kaṁsa thought that all the members of the Yadu dynasty were demigods and that any of the children born from the womb of Devakī might be Viṣṇu. Fearing his death, Kaṁsa arrested Vasudeva and Devakī and chained them with iron shackles. Suspecting each of the children to be Viṣṇu, Kaṁsa killed them one after another because of the prophecy that Viṣṇu would kill him
So, he killed six (not seven) children born to Devakī and Vasudeva. Seventh child was Balarama who was tranferred to the womb of Rohini which makes him seventh child. Krishna was eighth child.
You can read the story further in first chapter of tenth Skandha of Śrīmad-Bhāgavatam.
The reason why Narada muni planted this seed of fear and supicion in Kamsa's mind was liberation of six children who were sons of Marichi in their previous birth and born to Devakī and Vasudeva due to the curse of Lord Brahma. It is explained in detailed in this answer of mine. After they were killed in the hands of Kamsa, six children return to their own abode.
Note: “The question: The Oracle said that the eighth son of Devaki would kill Kansa, then why did he kill seven sons?” is licensed by Stack Exchange Inc (https://hinduism.stackexchange.com/); user contributions licensed under CC BY-SA.