Convert String to BigInt

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
gagan8877
Premium Member
Premium Member
Posts: 77
Joined: Mon Jun 19, 2006 1:30 pm

Convert String to BigInt

Post by gagan8877 »

I am trying to convert string field to Decimal in Transformer using:

StringToDecimal(string_field)

inside a Stage variable of datatype decimal(10, 0) and string_field is varchar(10).

but I get:

Transformer_7,1: Fatal Error: APT_Decimal::assignFromUInt64: the integer source (100013001) is out of range for a decimal with precision 8 and scale 0. [decimal/decimal.f.C:945]

Also tried with Decimal (15,0) as stage variable's data type - same error.

Is there a workaround in transformer? Will I have to use Modify stage?

Thanks
Gary
Last edited by gagan8877 on Wed Feb 15, 2012 5:49 pm, edited 1 time in total.
Gary
"A journey of a thousand miles, begins with one step"
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

100013001 has precision of 9 hence the error it won't fit into precision 8. Can you use a larger precision on your decimal data type?
Choose a job you love, and you will never have to work a day in your life. - Confucius
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can't fit a size 9 foot into a size 8 shoe. This is similar.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
gagan8877
Premium Member
Premium Member
Posts: 77
Joined: Mon Jun 19, 2006 1:30 pm

Post by gagan8877 »

Good analogy and thanks for the replies - I edited the original post to give you guys more info.

StringToDecimal(string_field)

basically the derivation is inside a Stage variable of datatype decimal(10, 0) and string_field is varchar(10).
Gary
"A journey of a thousand miles, begins with one step"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The message suggests that, somehow, DataStage is still seeing Decimal(8,0) as the data type. Time for some detective work.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dongyingying
Participant
Posts: 35
Joined: Tue Feb 07, 2012 2:28 am
Location: China BeiJing

Post by dongyingying »

Hi ,after you changed it ,did you recompiled it . if you did ,i think ,there will be something wrong of you datatype and even you transformer .
Dong Ying Ying Come on.
Post Reply