Worked for about 400 years. Even the great wall of China worked as long as it was manned and kept up. It kept out the Huns—but unmanned caused the mongols almost no time to breach. Even hear of the great wall of Korea? A great historic site-—too bad its in North Korea.
Walls are generally a poor idea militarily. The very considerable resources needed to build and maintain it are usually better spent on other military options.
A linear wall is useless if breached at any point. Whereas a series of strongpoints can be held and used as bases for a counterattack.