Data truncation

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
mcs_suman
Participant
Posts: 20
Joined: Thu Sep 27, 2007 8:42 am
Location: chennai
Contact:

Data truncation

Post by mcs_suman »

Hi,

I have a field named material in my database which is of length 18.But the max length of the value is 7.I am using the below query and specified the column length as 12 because I am joining with similar column of length 12.But i am getting the below warning..
If I set it as 18 as in Database then I have issues in joining as the similar couln to join has length 12.
Can any one help me with this.

Query used:

select substr(MATERIAL,1,max(length(ltrim(rtrim(MATERIAL)))))as MATERIAL from A GROUP BY MATERIAL

Warning:

The size specified for column 'MATERIAL' (12) is less than that of the source table column (18);data truncation may result.
suman
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi,

If you want to avoid these warnings, you can do the substring functionality in a transformer and then do a join.

HTH
--Rich
IBM Certified DataStage Solution Developer | Teradata Certified Master
mcs_suman
Participant
Posts: 20
Joined: Thu Sep 27, 2007 8:42 am
Location: chennai
Contact:

Post by mcs_suman »

Adding transformer downstream we can avoid warning..My question is if we fetch a value using sub string from a column we will specify only the desired length of the sub string and not the length of the source column...
In such case we get warning to use the Length of the source column.
Is it a bug with tool?
Regards
Suman
suman
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's not a bug - it's an alert. As the metadata are specified there exists a potential danger that you would lose data through truncation, so an alert (warning) message to this effect is logged.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply