Right Padding Spaces

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

chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Captain, we appear to be caught inside of some kind of time loop...
-craig

"You can never have too many knives" -- Logan Nine Fingers
landaghaar
Participant
Posts: 38
Joined: Wed Sep 19, 2007 10:11 am
Location: Canada

Post by landaghaar »

write your output to a file rather than oracle. look at the file, if you have "hello" in the file it means you are screwing something before loading, if you see "hello " then there is problem in loading.

make sure the string size is correct. if the target field in the transformer stage is char(5) and you padstring(in.XXX,' ',6) you will get a "hello" no matter what. make sure the target field is the right size, then make sure all the way upto table the size is correct. this is a common problem we get and just by looking at field size it can be solved.


someone said a char(10) will always be 10 characters, true and false. true about the amount of characters, false about spaces, char(10) = 'hello' will not make it 'hello '. in fact it will make it 'hellonullnullnullnullnull'
landaghaar
Participant
Posts: 38
Joined: Wed Sep 19, 2007 10:11 am
Location: Canada

Post by landaghaar »

write your output to a file rather than oracle. look at the file, if you have "hello" in the file it means you are screwing something before loading, if you see "hello " then there is problem in loading.

make sure the string size is correct. if the target field in the transformer stage is char(5) and you padstring(in.XXX,' ',6) you will get a "hello" no matter what. make sure the target field is the right size, then make sure all the way upto table the size is correct. this is a common problem we get and just by looking at field size it can be solved.


someone said a char(10) will always be 10 characters, true and false. true about the amount of characters, false about spaces, char(10) = 'hello' will not make it 'hello '. in fact it will make it 'hellonullnullnullnullnull'
bonds
Premium Member
Premium Member
Posts: 15
Joined: Thu Aug 16, 2007 12:34 am
Location: Australia

Post by bonds »

Hello All,

Finally, somehow got this working.

Firstly did a trim on my Source while reading from Oracle stage (User Defined SQL). Read it as Char in Column Definitions. Concatnated 10 spaces to it before putting it in Target field in Transformer(Link.XXX : ' ').

Extra spaces got trimmed off automatically while loading.

Environment Variable used is Oracle_Load_Delimited = ,

Still wonder why PadString didn't worked.

Any way I'll mark this resolved.

Thanks to All.
bonds
Premium Member
Premium Member
Posts: 15
Joined: Thu Aug 16, 2007 12:34 am
Location: Australia

Post by bonds »

Hello All,

Finally, somehow got this working.

Firstly did a trim on my Source while reading from Oracle stage (User Defined SQL). Read it as Char in Column Definitions. Concatnated 10 spaces to it before putting it in Target field in Transformer(Link.XXX : ' ').

Extra spaces got trimmed off automatically while loading.

Environment Variable used is Oracle_Load_Delimited = ,

Still wonder why PadString didn't worked.

Any way I'll mark this resolved.

Thanks to All.
bonds
Premium Member
Premium Member
Posts: 15
Joined: Thu Aug 16, 2007 12:34 am
Location: Australia

Post by bonds »

Probably it should be marked WorkAround not Resolved. So will mark this as WorkAround.

Cheers!!
Post Reply