MSCEWI2050
Translate function has different behavior in certain cases
Severity
Description
NULL parameters
SELECT OTRANSLATE('TestString', NULL, 'm5'); -- returns 'TestString'SELECT TRANSLATE('TestString', NULL, 'm5'); // returns NULLLength of the third parameter greater than the length of the second parameter
SELECT OTRANSLATE('hi123goodbye', 'io', 'a0F5');
-- replaces all i with a and all o for 0 as expected, F and 5 are ignoredExample code
Input code:
Output code:
Recommendations
Last updated
