Created
February 23, 2022 03:14
-
-
Save dnedrow/2843e77d1b45aae35fa654f030fef550 to your computer and use it in GitHub Desktop.
How to get leading digits when retrieving data from PostgreSQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| with sample_numbers (nr) as ( | |
| values (1),(11),(100) | |
| ) | |
| select to_char(nr, 'fm000') | |
| from sample_numbers; | |
| /* | |
| Example output: | |
| to_char | |
| --------- | |
| 001 | |
| 011 | |
| 100 | |
| (3 rows) | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment