Problem with varchar field

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
arnie_nits
Participant
Posts: 101
Joined: Mon Aug 13, 2007 2:32 am

Problem with varchar field

Post by arnie_nits »

Hi

I have got a varchar field of length 12,2. When data(say 16.25) is populated in it comes as 000000000016.25.

I want to get it as 16.25,without any zeros being padded in left. Please help.

Regards
Arnie
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You have a Decimal field, not a VarChar field. (16,2) is not valid for VarChar. If, having converted this to a string there are leading zeroes, this is how DataStage does things. It displays leading (and trailing) zeroes to demonstrate that decimal precision and scale are being handled properly. Internally, of course, they are represented in a binary format.

To convert the "0" characters to " " characters or "" characters in the string the most efficient function to use is Convert().
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Prabhakar
Participant
Posts: 10
Joined: Mon Apr 02, 2007 6:28 pm
Location: Melbourne

Post by Prabhakar »

as Ray mentioned you may be decalared the coulmn as Decimal instead of decimal. so please check the scema of your job
Last edited by Prabhakar on Tue Jan 01, 2008 11:43 pm, edited 1 time in total.
Prabhakar
Participant
Posts: 10
Joined: Mon Apr 02, 2007 6:28 pm
Location: Melbourne

Post by Prabhakar »

as Ray mentioned you may be decalared the coulmn as Decimal instead of Varchar. so please check the scema of your job
Post Reply