Fastexport

Tools
Enthusiast

Fastexport

hi

i m trying to fast export some data from a table to a file.
i have an amount field in a decimal format in the table and i need to export it to the file in signed integer format. i.e, the field is in DECIMAL(14,2)format and i want it as S9(12)v99 format in the file.

i tried putting like this in the query,
TOT_AMT (FORMAT '9(12)V99') (CHAR (14)), it didnt work..
then i changed it to
TOT_AMT (FORMAT '-9(12)V99') (CHAR (14)), this puts the sign in front of the value, but one of the decimal part is not getting displayed..

if the value in the table is -000000100033.93
i want it to be exported to the file as 00000010003393{

pls help me on this..
1 REPLY
Enthusiast

Re: Fastexport

Hello,
In the formatting string, you have to specify the number of characters assigned. In this format, a decimal point '.' is also a character and hence has to be assigned a place. Hence increase the formatting by one more character and you should get the desired output:

TOT_AMT (FORMAT '9(12)V99') (CHAR (15))
which is 12 digits before the decimal point + 1 for the decimal point + 2 digits after the decimal point = 15.
If you want the sign of the number, you can just use:
TOT_AMT (FORMAT '-9(12)V99') (CHAR (15)) as Teradata implicitly adds one place for the sign and hence you do not have to consider it during format specification. Hope that helps.