2

I need to add a dot in the 4th position of each string in a column. How can I perform this in Postgres?

Example: '1234' should become '123.4'

1
  • These are codes and they can contain letters as well! Commented Sep 26, 2016 at 8:56

1 Answer 1

4

For example use left / right:

db=> select left('1234', 3) || '.' || right('1234', -3);
 ?column? 
----------
 123.4
Sign up to request clarification or add additional context in comments.

1 Comment

Worked! Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.