Numeric value issue

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
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Numeric value issue

Post by rsunny »

Hi,

I am trying to generate a unique sequence number and appending that value to a string and the data type of that column is varchar.
For example the value would be 'ABC_123', but for my scenario the value is populating as 'abc_7.61778e+06' instead of 'abc_7617780'

Can you please help me to get the solution as i tried using stringToDecimal but didnt work.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

An exact search here for "scientific notation" might prove helpful.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi craig,

I did a search on "scientific notation" but couldnt able to find a solution.

One solution i have in my mind is for example if i am getting the value as 7.61778e+06 then i can take the number before 'e' and multiply by 10 and the number after + which is '6' i.e 7.61778*10*06.

Can you please provide me a better solution if there is any other alternative solution.
And what would be the reason of getting a value as abc_7.61778e+06 of datatype as Varchar.
Is it because before the number there is a string , so it converts the value into abc_7.61778e+06 instead of 'abc_7617780'
mobashshar
Participant
Posts: 91
Joined: Wed Apr 20, 2005 7:59 pm
Location: U.S.

Post by mobashshar »

Have you tried Concatenating the unique seq numeric value to varchar field?
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

yes my value will be 'abc_uniqueseqnumber
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

Try a different datatype for the number you are generating (would I be correct if I guess you have it defined as a float or double-float?)

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
rsunny
Participant
Posts: 223
Joined: Sat Jul 03, 2010 10:22 pm

Post by rsunny »

Hi,

Can you please provide me the solution as i need to use the datatype as Varchar . If i use the datatype as Integer it works but i nmeed to use the datatype as Varchar . And if i use Varchar i am not able to generate the number
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So "use" it as an Integer and then convert it to a string before you concatenate it to your other varchar.
-craig

"You can never have too many knives" -- Logan Nine Fingers
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

How do you currently generate the sequence number? A stage variable which you then concatenate to the other string before output? That stage variable should be an integer or big integer.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
Post Reply