Issues with Decimal Field in Fastload Script

Database
Enthusiast

Issues with Decimal Field in Fastload Script

Hi- I am using a fastload script to load a .csv into Teradata. The only problem I am having is with importing the data in the   "Charge" column as a decimal. Typically data in this column is as such:

"Charge"

0.231

0

0.043

1.45

3.743

I am trying to maintain data 3 places to the right of the decimal point, but for some reason the data is being rounded as such:

"Charge"

0

0

0

1

4

Below is the script I am using to load data from  the csv into a teradata table :

fastload <<!END 1>fastload_desk_call_history.txt 2>&1

SESSIONS 4;

RECORD 2;

ERRLIMIT 25;

.LOGON tdwc/username,password;

DROP TABLE sandbox.desk_call_hist_upload;

DROP TABLE sandbox.desk_call_hist_uploadERROR1;

DROP TABLE sandbox.desk_call_hist_uploadERROR2;

CREATE TABLE sandbox.desk_call_hist_upload, NO FALLBACK

(

Call_Record_ID VARCHAR(18)

, Ticket_ID VARCHAR(18)

,Date_Time VARCHAR(16)

-- , Date_Time TIMESTAMP(0) FORMAT 'YYYY-MM-DDBHH:MI'

, Call_From VARCHAR(10)

, Call_To VARCHAR(10)

, Forward_To VARCHAR(10)

, Agent VARCHAR(40)

, Call_Status VARCHAR(25)

, Wait_Time_sec INTEGER

, Minutes_on_Call INTEGER

, Charge Decimal(3)

, Hold_Time INTEGER

, Wrap_Up_Time INTEGER

)  PRIMARY INDEX(Call_Record_ID);

SET RECORD VARTEXT ',' DISPLAY_ERRORS;

DEFINE 

Call_Record_ID (VARCHAR(18))

,  Ticket_ID (VARCHAR(18))

,  Date_Time (VARCHAR(16))

,  Call_From (VARCHAR(10))

,  Call_To (VARCHAR(10))

,  Forward_To (VARCHAR(10))

,  Agent (VARCHAR(40))

,  Call_Status (VARCHAR(25))

,  Wait_Time_sec (VARCHAR(25))

,  Minutes_on_Call (VARCHAR(25))

,  Charge (VARCHAR(10))

,  Hold_Time (VARCHAR(25))

,  Wrap_Up_Time (VARCHAR(25))

   FILE=/home/user22/callhist_formatted.csv;

SHOW;

BEGIN LOADING sandbox.desk_call_hist_upload ERRORFILES sandbox.desk_call_hist_uploadERROR1,sandbox.desk_call_hist_uploadERROR2

   CHECKPOINT 10000;

INSERT INTO sandbox.desk_call_hist_upload (

Call_Record_ID

,Ticket_ID

,Date_Time

,Call_From

,Call_To

,Forward_To

,Agent

,Call_Status

,Wait_Time_sec

,Minutes_on_Call

,Charge

,Hold_Time

,Wrap_Up_Time


VALUES (

:Call_Record_ID

,:Ticket_ID

,:Date_Time

,:Call_From

,:Call_To

,:Forward_To

,:Agent

,:Call_Status

,:Wait_Time_sec

,:Minutes_on_Call

,:Charge

,:Hold_Time

,:Wrap_Up_Time);

END LOADING;

LOGOFF;

1 REPLY
Supporter

Re: Issues with Decimal Field in Fastload Script

The issue is 

, Charge Decimal(3)

You don't specify the decimal fraction so it will be 0.

try

, Charge Decimal(6,3)