You can build a fence on top of a retaining wall. You can read our guide on Building a Fence on Top of a Retaining Wall here.