In a postgres table I have a column with values like:
x
code
=============
000A450
00BVDDE
0FGR0SE
GVSDD33
I need to delete all 0 before the next character that is NOT a 0. So, the previous column will became:
new Code
=============
A450
BVDDE
FGR0SE
GVSDD33
Is this possible in psql?
Advertisement
Answer
SELECT ltrim('00BVDDE', '0');
ltrim
═══════
BVDDE
(1 row)
(No comment necessary.)