oracle padding spaces at the end

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
peddidsx
Premium Member
Premium Member
Posts: 55
Joined: Wed Dec 26, 2007 8:20 am

oracle padding spaces at the end

Post by peddidsx »

Hi All,

I have an attribute called country_name of varchar2(50). I am using a below logic in my transofrmer:

If state = 'aa' Then 'Other' Else 'US' but the data is getting loaded as US with 48 spaces. Oracle padding the spaces at the end.

I checked APT_ORACLE_PRESERVE_BLANKS is set to false but still it is appending spaces.

I am using upsert mode and insert script in user defined sql.

Kindly pass an information to me.

Thanks
Madhu
Rajesh Peddi
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi,

Use the APT_STRING_PADCHAR environment variable with 0x20 in the job parameters and run the job. Let us know if that resolves the issue.

HTH
--Rich
peddidsx
Premium Member
Premium Member
Posts: 55
Joined: Wed Dec 26, 2007 8:20 am

Post by peddidsx »

Hi,

I kept the string_padchar value to 0x20, but still the spaces are padding at the end. Eventhough i am hardcoding the value as "US" for country name, but somehow the oracle is taking the full lenght and adding 28 spaces at the end.

I couldn't able to find what is the problem.

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

Post by ray.wurlod »

If you use a Sequential File stage do you still get the padding? If not, dare I suggest that it is Oracle, rather than DataStage, that is padding the strings? Get the DBA to trace a few rows of the data being inserted.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

in the transformer stage, what is the column type defined for this field.

use user define insert and update query and trim the input columns
Post Reply