You need to create a user-defined function that takes a string and returns an extended string. Assumptions: the string contains only one numeric component that is at the end and is smaller than the maximum integer size determined by the filling in fn. For example, ABC1234 → ABC00001234 ABC34 → ABC00000034 Follow these steps.
- Starting from the last character, Iterate through the character string transmitted by character (decreasing position) to the first numeric character. (C)
- get the length of the numerical part (4)
- add the plural "0" characters to the numeric part of the string (this determines the maximum size of the processed numeric part) (for example) 00001234
- The prefix is not the numeric part of the string giving ABC00001234
- Exit
Sort by output You can also add a calculated field (which uses the function you just created) that returns this value and creates an index on it.
Ian p source share