I have the following problem.
I use PostgreSQL and I have a string with multiple values that are repeated. I need to take that value and replace it with another value from another table.
Example
String cadena = "Se actualizarón ordenes de ejecución, de valores: Tipo de mensaje_1,Posición_3Tipo de mensaje_2,Posición_2Tipo de mensaje_3,Posición_1";
What I need is to replace all the characters that are after the hyphen under "_" with a value from another table.
ID | VALUE
1 | One
2 | Two
3 | Three
To make the chain look like this:
String cadena = "Se actualizarón ordenes de ejecución, de valores: Tipo de mensaje_Uno,Posición_3Tipo de mensaje_Dos,Posición_2Tipo de mensaje_Tres,Posición_1";
That's what I do in a PostgreSQL function, so I need to use PL / PGSQL. It should be noted that the characters I need to replace may appear N times inside the String.
Any help?