| From: | "Alejandro D(dot) Burne" <alejandro(dot)dburne(at)gmail(dot)com> |
|---|---|
| To: | pgsql-es-ayuda(at)postgresql(dot)org |
| Subject: | Re: Formato de los datos de tipo numeric |
| Date: | 2007-02-22 12:46:39 |
| Message-ID: | 8398dc6d0702220446r2b3379ddhb377848636878bb4@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-es-ayuda |
Una alternativa es dandole formato a texto:
to_char(numeric, text) text convert numeric to string ->
to_char(-125.8, '999D99S')
Pattern Description
9 value with the specified number of digits
0 value with leading zeros
. (period) decimal point
, (comma) group (thousand) separator
PR negative value in angle brackets
S sign anchored to number (uses locale)
L currency symbol (uses locale)
D decimal point (uses locale)
G group separator (uses locale)
MI minus sign in specified position (if number < 0)
PL plus sign in specified position (if number > 0)
SG plus/minus sign in specified position
RN roman numeral (input between 1 and 3999)
TH or th ordinal number suffix
V shift specified number of digits (see notes)
EEEE scientific notation (not implemented yet)
Alejandro
El 22/02/07, Rafa Comino <rafacomino(at)gmail(dot)com> escribió:
> Existe alguna forma o función para formatear un dato de tipo numeric(38,2)
> para que muestre siempre los dos decimales, incluso siendo estos 00
> Yo hago las pruebas
> SELECT 20.83::numeric(38,2) y me deveulve 20.83 con los decimales.
> SELECT 20.00::numeric(38,2) y me deveulve 20 sin los decimales, y necesito
> tenerlos
> Debe ser muy fácil, pero no encuentro como hacerlo.
>
> Gracias de antemano a todos
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Guido Barosio | 2007-02-22 13:25:43 | Re: postgresql-latam.org ya existe, no tiene nada |
| Previous Message | Mario | 2007-02-22 12:41:08 | Re: postgresql-latam.org ya existe, no tiene nada |