I have the following string in an Oracle 9i database:
A,B,C,
I need to replace all instances of ',' when it is the last item in the string. I have come up with the following statement but it deletes everything in the field not just the comma. Any suggestions?
UPDATE table SET column = REPLACE(SUBSTR(column, -1, 1), ',', '');
Oracle REPLACE() Function This function is used to replace the sequence of character with another character in the given string.
rtrim(column, ',')
is both efficient and much shorter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With