Home > Enterprise >  How To Add Double Quotes To Every Number In The Same Column In Postgres
How To Add Double Quotes To Every Number In The Same Column In Postgres

Time:04-06

I have a data like the below in one of the columns in the table and I need to add double quotes to every string. Could anyone advise how to do this in Postgres?

Actual Data:

["607"]
["586,603"]
["586,603","900"]

Expected Output:

["607"]
["586","603"]
["586","603","900"]

Thanks in Advance.

CodePudding user response:

You can use function REPLACE:

Step 1: Replace all "," to ,

Step 2: Replace all , to ","

EX:

UPDATE TABLENAME SET COLUM_NAME=REPLACE(REPLACE(COLUM_NAME,'","',','),',','","')
  • Related