Re: [GENERAL] Extra space when converting number with to_char

2012-11-07 Thread Bruce Momjian
On Fri, Oct 26, 2012 at 04:11:42PM -0400, Samuel Gilbert wrote: > Thank you, it works. The documentation gave me the impression that the FM > modifier only applied to date/time since it was under "Usage notes for > date/time formatting:" Uh, I see: FM prefix fill mode (suppress

Re: [GENERAL] Extra space when converting number with to_char

2012-10-26 Thread Samuel Gilbert
Thank you, it works. The documentation gave me the impression that the FM modifier only applied to date/time since it was under "Usage notes for date/time formatting:" Samuel On Friday, October 26, 2012 16:01:08 Moshe Jacobson wrote: > You want to use a format of 'FM0' (fill mode, does

Re: [GENERAL] Extra space when converting number with to_char

2012-10-26 Thread Moshe Jacobson
You want to use a format of 'FM0' (fill mode, doesn't leave an extra space for sign) On Fri, Oct 26, 2012 at 2:50 PM, Samuel Gilbert wrote: > Hello, > > I've encountered an unexpected behavior when converting a number to > char. I > need to match an INTEGER with a VARCHAR(9) that has l

Re: [GENERAL] Extra space when converting number with to_char

2012-10-26 Thread Bosco Rama
On 10/26/12 11:50, Samuel Gilbert wrote: > >(SELECT to_char(42, '0') AS string) AS example; > >string | length | showthemtome > ++-- > 00042 | 10 | " 00042" Sign padding. Try using: select to_char(42, 'FM0') ... To see

Re: [GENERAL] Extra space when converting number with to_char

2012-10-26 Thread David Johnston
Placeholder for a +/- sign so that both positive and negative values have equal lengths. David J. On Oct 26, 2012, at 14:50, Samuel Gilbert wrote: > Hello, > > I've encountered an unexpected behavior when converting a number to char. I > need to match an INTEGER with a VARCHAR(9) that has

[GENERAL] Extra space when converting number with to_char

2012-10-26 Thread Samuel Gilbert
Hello, I've encountered an unexpected behavior when converting a number to char. I need to match an INTEGER with a VARCHAR(9) that has leading zeros. When I tried to match them using to_char(num, '0') I didn't get anything. I later found out that to_char adds a leading space. This