Either one will clear the code, but removing the battery B- cable also clears the KAM (Keep Alive Memory).
So, the computer will have to relearn some new things, like it's cold & warm idle strategy & it'll have to begin to build new fuel trim tables, as they are wiped with a battery cable disconnect.
It'll also have to be driven through a certain routene for the IM monitors to reset, so it'll be ready for emissions testing.
If you don't need to have emissions testing done right way, then the IM monitors will reset over time, after enough driving is done.
If you use your scan tool to erase the code, it won't mess with the KAM, so all of the above is avoided.