StringToDecimal

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
laxman.ds
Premium Member
Premium Member
Posts: 66
Joined: Thu Mar 02, 2006 9:00 am

StringToDecimal

Post by laxman.ds »

Hi All,

I am Extract Data from .csv file, and loading to Oracle Database.
I am using StringToDecimal Conversion but i am getting 0 instead of actual value in Target Database...
Input is .csv file it's a comma seprated and partially Quoted file...

i used the following methord but i am not getting proper Result:--

1. StringToDecimal(Column_Name)
2. Trim(StringToDecimal(Column_Name))
3. StringToDecimal(Trim(Column_Name))
4. Trim(StringToDecimal(Trim(Column_Name)))

Please suggest me some solution...

Thanks & Regards,
Sandeep
2 B 1 4 ALL
AmeyJoshi14
Participant
Posts: 334
Joined: Fri Dec 01, 2006 5:17 am
Location: Texas

Post by AmeyJoshi14 »

Guess you have specify length for the output Decimal field as 1 . That is causing the error :?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What datatype and length is your source String column defined as? Option (2) and (4) won't work as your output is a decimal column. Option (3) is my preferred one, although (1) might work.

What is a "partially quoted" file?

Can you write just your original string and Decimal converted columns to a PEEK stage and post the output for one or two rows?
karunakar.ds
Participant
Posts: 9
Joined: Fri Jun 01, 2007 12:14 am

Post by karunakar.ds »

Hi,

I also tried the option 3 but it is not working, it is just loading 0 in the target table column. But it suppose to load a decimal value like 23.09 or 3.98 etc.. in the target column


Thanks,
Karunakar
karun
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

For the records which you are getting 0 in the database, can you check what is the exact value from your .csv file. I guess it is empty.
Thanks and Regards!!
dspxlearn
nkreddy_3

Post by nkreddy_3 »

Hi,

Thanks for thr reply.

The value is not 0 in the file. But I dont know why it is loading 0 in the table.

Appricaite your help on this

Thanks,
Karunakar
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

nkreddy_3 - are you also working on the same file and problem as the original poster? If not then we should wait for the original poster to reply if his/her file has empty or zero values.
AxBad
Participant
Posts: 2
Joined: Fri Jan 25, 2008 2:01 am
Location: München

Post by AxBad »

Hi,

did you already try Modify Stage using this specification :

column_out:decimal[8,0] = decimal_from_string(column_in)

If you don't specify [length,scale], you'll get unexspected results like e.g. NULL.

Hope this helps
Axel
Post Reply