sqlstringpostgresqltext

How to remove first & last character of a text?


I have a record that was converted into text like this:

("{""ACC_CODE"":""0/000"",""ACC_DECIMAL"":2}"})

I want to remove the ( and the ) so that I could convert the text into json. How do I do that?

Edit: I don't want to use trim function because there are ( & ) characters in the original text.

I just want to remove the first & last character.


Solution

  • You can do:

    select substr(col, 2, length(col) - 2)