You don't have to care about CHARs or VARCHARs, because trailing spaces simply don't matter, e.g. '0123' and '0123 ' compare equal.
But the leading zeroes (or leading blanks) cause trouble and you need to get rid of them. You should use Raja's approach, just change BOTH to LEADING.
You don't have to care about CHARs or VARCHARs, because trailing spaces simply don't matter, e.g. '0123' and '0123 ' compare equal.
But the leading zeroes (or leading blanks) cause trouble and you need to get rid of them. You should use Raja's approach, just change BOTH to LEADING.