Formatting in Teradata

Database
Teradata Employee

Formatting in Teradata

Hi guys,

New on Teradata. For a client I am trying to format some numbers. The wish is to paste the string 'EUR' to a value as follows.

EUR 0.32

EUR 0.00

EUR 189.56

EUR 1,234.87

We have tried different formats, but face some challenges. For instance, the format G9D99 works fine for the first two, but does not work with the larger numbers. And the formate G-Z(10)D9(2) works fine for the larger numbers, but removes the first zero with the smaller numbers.

Is there a format that can fullfill both our wishes?

Hope to hear something :)

Kind regards,

Helena

Tags (2)
4 REPLIES

Re: Formatting in Teradata

Hi

Have you tried FORMAT 'G-(9)9D9(2)' ?

HTH.

Cheers.

Carlos.

Teradata Employee

Re: Formatting in Teradata

THANK YOU CARLOS!!!!!

I understand the format mostly, only the part (9)9 not totally. Do you have an explanation for this?

I saw that the format 'G-999999999D(9)2' fills up the positions with zero's, while your solution fills it up with spaces. Why is that?

Anyway; many thanks!

Re: Formatting in Teradata

Hi.

G=Group Separator

-(9)=Minus sign (if applicable) for 9 positions

9=Last number before decimal separator mandatory.

D=Decimal Separator

9(2)= two decimal positions.

Cheers.

Carlos.

Teradata Employee

Re: Formatting in Teradata

Got it! Thats why my 999999999 resulted in leading zero's, because you then say it is mandatory to put a number on that position.

Well, you made me and a client happy today, thanks and have a good day!