Unanswered: looking for a function in Sybase which does what TRANSLATE does for Oracle
I am using Sybase ASE 12.5.2 and my need is such that I have to replace all occurrences of a bunch of characters by another bunch of characters.
Here is an example of what I want accomplished -
SELECT TRANSLATE(FIRSTNAME, 'ABCD', '1234') F from NAMES
this is an imaginary condition where all occurrences of ABCD in FIRSTNAME would be replaced with 1, 2, 3, & 4 respectively. So ALEX will become 1LEX
and ALICIA will become 1LI3I1. What is important to note here is that 'ABCD' is not to be considered as one string. (Basically I am trying to replicate the TRANSLATE function in Oracle)
the closest function I could come across was str_replace() but this too does not do the exact replacement as explained earlier. It considers the string 'ABCD' as one string and looks for it together to replace it with 1234 but not the way I need. Is there any function in Sybase that can help me achieve the above?