to_char(number) function in postgres
问题 i want to display/convert a number to character (of it's same length) using to_char() function . In oracle i can write like SELECT to_char(1234) FROM DUAL But in postgres SELECT to_char(1234) is not working. 回答1: You need to supply a format mask. In PostgreSQL there is no default: select to_char(1234, 'FM9999'); If you don't know how many digits there are, just estimate the maximum: select to_char(1234, 'FM999999999999999999'); If the number has less digits, this won't have any side effects.