U kunt de rpad . gebruiken en lpad functies om nummers respectievelijk naar rechts of naar links te toetsen. Let op:dit werkt niet rechtstreeks op getallen, dus je moet ::char . gebruiken of ::text om ze te casten:
SELECT RPAD(numcol::text, 3, '0'), -- Zero-pads to the right up to the length of 3
LPAD(numcol::text, 3, '0') -- Zero-pads to the left up to the length of 3
FROM my_table