how to avoid warngs when convert from varchar(10) to char(4)
Moderators: chulett, rschirm, roy
how to avoid warngs when convert from varchar(10) to char(4)
I am using a modify stage and in specification i specified
target_column:string = source_column
where target_column is specified as CHAR(4) and source column is defined as Varchar(10)
I am getting warning with possible trucation. how can i avoid this warning message.
target_column:string = source_column
where target_column is specified as CHAR(4) and source column is defined as Varchar(10)
I am getting warning with possible trucation. how can i avoid this warning message.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
thanks all for the replies
thanks every one for their reply. i can use Left() function to get the required four characters from the source_column. is there any other way of doing the same... without using Left/Right functions
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Hi Ray,
I used a substring function and in the specification, i included
though the field is converted from length(10) to length(4), i am getting a warning message
I used a substring function and in the specification, i included
Code: Select all
target_column:string[4]=Handle_Null(substring[0,4](source_column),"").
Modify_135: When checking operator: When binding output schema variable "outRec": When binding output interface field "target_column" to field "source_column": Conversion from source type "string[max=10]" to result type "string[max=10]": Taking substring of variable-length source string.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Your replacement value for null does not contain four characters. It must, if it's destined for a string[4] field.
Irrespective of that, Modify is very verbose about what it's doing. Create a message handler to demote this warning to an informational message.
Irrespective of that, Modify is very verbose about what it's doing. Create a message handler to demote this warning to an informational message.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
I am still getting warning message
I am still getting warning messages though i converted the replacement string to 4 characters.. the specification looks like
I am still getting the same warning message. Please suggest if there is any alternative
Code: Select all
target_column:string[4]=Handle_Null(substring[0,4](source_column),"xxxx").
Modify_135: When checking operator: When binding output schema variable "outRec": When binding output interface field "target_column" to field "source_column": Conversion from source type "string[max=10]" to result type "string[max=4]": Taking substring of variable-length source string.
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
I hate to say it and it probably makes me a lazy programmer but this is why I don't spend a lot of time trying to get warning messages to go away.
You can lose days on it and the behaviour of the job does not change one whit. Go for the message handler if you are sure the warning is not harming your job and it has been accepted by your testers.
![Evil or Very Mad :evil:](./images/smilies/icon_evil.gif)
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
that works..
Hi Meera..
this worked for me.. thanks for resolving the issue.
thanks everyone for their input and suggestion.
this worked for me.. thanks for resolving the issue.
thanks everyone for their input and suggestion.