Think about it for just a moment. Does God ever literally change his mind or course of action? The Christian tradition usually sides with the, ‘No.’ Well, if you say know let me ask you something. What would you do with cognitive, so-called, anthropomorphisms concerning peitionary prayer or changing his course of action (i.e. God changing his mind in response to prayer or sparing Ninenveh)? The traditional hermeneutic concerning anthropomorphisms approaches these statements as literary elements in which God expresses himself through human or animal terms that teach something true about God. Expressions like “the right hand of God” or “the eyes of the Lord,” for example, communicate something true of God’s strength and knowledge. But what does the concept of God’s changing his mind communicate? For example, if indeed it is anthropomorphistic? If God in fact never actually changes his mind [due to prayer], saying he does so doesn’t communicate anything truthful. It is simply inaccurate.[1]
I would argue that a multi-layered middle knowledge approach is sufficient to answer the question. I’m approaching this as a Molinist so if you need a refresher on middle knowledge please read Middle Knowledge in a Nutshell. By introducing a second logical moment in to God’s knowledge, knowledge of the subjunctive conditionals or would-counterfactual knowledge, it is the case that petitionary prayer actually makes a difference. In God’s middle knowledge there rests two additional layers: the first layer being reaction and the second layer being action. The first layer is God’s progressive apprehension of the truth-value of all would-counterfactuals of creaturely freedom as they unfold in the logical sequence coupled with his original reactions to these counterfactuals. The second layer is God’s transformation of each practicable world into a feasible world by fine-tuning it according to his full knowledge of everything that could or would happen in the entire history of that world as a result of different divine responses to creaturely choices.
For an example consider Exodus 32.9-14.
The Lord said to Moses, “ I have seen this people and behold, they are an obstinate people. 10Now then let Me alone, that My anger may burn against them and that I may destroy them; and I will make of you a great nation.” 11Then Moses entreated the Lord his God, and said, “ O Lord, why does Your anger burn against Your people whom You have brought out from the Land of Egypt with great power and with a mighty hand? 12Why should the Egyptians speak, saying, ‘With evil intent He brought them about to kill them in the mountains and to destroy them in the from the face of the earth’? Turn from Your burning anger and change Your mind about doing harm to Your people. 13Remember Abraham, Isaac, and Israel, Your servants to whom You swore by Yourself, and said to them, ‘I will multiply your descendants, and they shall inherit it forever.’” 14So the Lord changed His mind about the harm which He said He would do to His people. (Ex. 32.9-14 NASB)
God’s original reaction, only having apprehended the truth of the circumstances logically leading up to this, was to literally destroy the Israelites and make a new nation from Moses to uphold his covenant with Abraham. Upon apprehending the logically successive knowledge that Moses, if apprised of this reaction, would implore God to spare the Israelites, God’s mind, or planned reaction, literally changed to a new course of action which left the Israelites intact.[2]
Does this effect or change God’s ontology? No. This preserves divine perfection. This approach isn’t as controversial as you may think (regarding divine perfection) because these logical moments are known logically prior to the creative decree. Not only does this preserve divine perfection but it also preserves the veracity of biblical statements regarding God’s cognitive discourse without diluting the reality of the relationship in prayer and God’s sovereign control of history.