In order to cast divine spells, a cleric needs to have a wisdom of 10 + spell level. So by level 17 your cleric would need to have a wisdom of 19 to cast 9th level spells. Since you get attribute raises at levels 4, 8, 12, 16 and 20, you would need to have a starting wisdom of a minimum of 15 in order to cast 9th level spells by level 17. That is only if you sink all your attribute raises into wisdom. I hope that helps.