pad column with leading zeros or space

From: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: pad column with leading zeros or space
Date: 2002-01-23 16:13:17
Message-ID: 73309C2FDD95D11192E60008C7B1D5BB0452DD9E@snt452.corp.bcbsm.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Howdy:

I'm running Postgres 7.1.3 on Mandrake Linux 8.0 kernel
version 2.4.16.

I am trying to create a table where I need to pad certain
columns. For example, I have a column where it's defined
as an integer 10 but has to be padded with leading zeros,
so the results should be:

0000200201

instead of

[space]200201

At the same time, I have to define a column similar to char (25),
but left justify it with trailing bytes filled with spaces.

In the end, the entire output of a dump should have a specific
format (like COBOL) where there is a start and end position.

Yeah, well, I don't know why a delimited format wouldn't
help the clients, but it seems that they've hardcode
their process so that the text dump will look *exactly*
as specified.

Can someone point me to the right docs / examples?

Thanks!

-X

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-01-23 16:15:58 Re: postgresql 7.2b5 and vserver: statistics sockets
Previous Message postgresql 2002-01-23 16:10:02 Re: postgresql 7.2b5 and vserver: statistics sockets