There are two sides of the coin. One is for exterior access, which is normally taken care of by a fence. If the fence requirements are met by the retaining wall, and the inspector sees it that way, then you would be ok. However i suspect that the requirements may not be met. For example, our fence needs to be 48" high. Most retaining walls are not 48" above grade.
The second piece is from a fall off the deck perspective. Our decking ends on top of a retaining wall. The deck to ground level could not exceed 30" or I would have needed a railing (not a fence). The fence would still be needed outside of that in our case. We graded the dirt up to be 30" or less to eliminate the railing requirement.
But as Cowboycasey said, it's all about your local requirements. Check for deck/railing requirements and also for pool/fence requirements.