He was a prophet, and he knew that God had sworn him an oath to seat one of his own descendants on his throne.
In context
28You have shown me the paths of life; you will fill me with gladness in your presence.’ 29Brothers, I may speak to you plainly about the patriarch David: he died and was buried, and his tomb is here among us to this day. 30He was a prophet, and he knew that God had sworn him an oath to seat one of his own descendants on his throne. 31He saw it in advance and spoke of the resurrection of the Christ: that he was not abandoned to Hades, nor did his body see decay. 32This Jesus God raised up, and of that we are all witnesses.