To_Char for Numeric --> Char?

The DI reference guide indicates ( on p. 572 for version 11.7) that you can use the to_char function to convert a numeric to a character. Is this right? If so, is there any trick to getting it to take the 2nd parameter to format the numeric input into a character output? I’m having no luck. Thanks.


peterp16 :us: (BOB member since 2006-10-13)

.deleted.


Werner Daehn :de: (BOB member since 2004-12-17)

Is it possible to create special formats using the to_char() function? I mean, like Excel formatting.

For example, I need to format a number (an integer) to “ABC-000000”. So 1234 would be formatted to ABC-001234.

The documentation doesn’t specify other formatiing characters for numbers, such us the dollar or euro signs.

Regards,

Andrés

PD: I’ve already read Werner’s link


aidelia :argentina: (BOB member since 2006-02-02)

Werner,

Is it still available the link you’ve provided for this post? I couldn’t reach it.

If, as I suppose, it has been migrated to SAP/BO site, could you provide the new address?

BTW, is there a list of valid NUMBER formats for to_char() in DI?

Thanks,

Andrés


aidelia :argentina: (BOB member since 2006-02-02)

col_text || '-' || ltrim_blanks(to_char(col_int, '000000'))

The function understands in 12.1
9 …a single number digit or omitted
0 …a single number digit or zero
D. …a period as decimal separator
D, …a comma as decimal separator
G. …a period as group separator or use a comma or a blank char
x …convert the number into hex using lower case chars
X …as above with uppercase
O …as above but octal numbers


Werner Daehn :de: (BOB member since 2004-12-17)