What does Psalm 40:6 mean?
David ponders how he might show his gratitude for all the wondrous things God had done him (Psalm 40:1–5). Certainly, David knew that God accepted and even commanded certain physical sacrifices under the Old Testament law. However, David has enough wisdom to understand that God looks at the worshiper's heart and not simply at his sacrifices and offerings.King Saul had learned the hard way what David knew: The Lord delights in obedience and not in the ritual of offering sacrifices while the heart is not in tune with His will. Samuel reprimanded Saul for disobeying the Lord by not slaying Agag and all that pertained to Agag and by offering sacrifices after disobeying the Lord. He told Saul: "Behold, to obey is better than sacrifice, and to listen than the fat of rams" (1 Samuel 15:22). David testifies that the Lord had given him an open ear; that is, David listened to hear what the Lord commanded him.
The phrasing used here is apparently a Hebrew idiom—a figure of speech—which in many literal translations implies "digging ears." The meaning of the phrase is God forming the body such that a person has the privilege of hearing from God. The Septuagint, a Greek translation of the Old Testament, takes this approach, which is why Hebrews 10:5 speaks of God preparing a body. Whether in the poetic form of Hebrew or the literalized version of Greek, the point is the same: the Lord has "dug out," or "opened," or "created" the ears of David so he can hear from God.