In Informix DataBase condtion for NULL value getting fail
Moderators: chulett, rschirm, roy
In Informix DataBase condtion for NULL value getting fail
Hi
In DS I given following condition
If (Column1= 'Y' AND Column2= 'Y' AND Column3= 'Y' AND Column4= 'Y' then 'Y' else 'N')
But when ALL the column's getting NULL value then in Target Table updating with NULL value. According to my requirement It should be either 'Y'(if Condition thru) or 'N'
Due to this problem most of the record not updating in target Table!!
Please suggest me How I can solve this problem.
In DS I given following condition
If (Column1= 'Y' AND Column2= 'Y' AND Column3= 'Y' AND Column4= 'Y' then 'Y' else 'N')
But when ALL the column's getting NULL value then in Target Table updating with NULL value. According to my requirement It should be either 'Y'(if Condition thru) or 'N'
Due to this problem most of the record not updating in target Table!!
Please suggest me How I can solve this problem.
Regards,
Prasoon
Prasoon
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Welcome aboard. :D
NULL is always a tricky concept, and therefore should be explicitly handled.
It is also the case that your expression
has the right parenthesis misplaced - it should follow "Column4='Y'". This alone may be a sufficient correction, since NULL always takes the ELSE path in an IF statement, on the grounds that it can never be asserted to be "true".
However, I always advocate handling NULL explicitly, if for no other reason than to communicate to the next developer that I've considered it.
NULL is always a tricky concept, and therefore should be explicitly handled.
Code: Select all
If (IsNull(Column1) Or IsNull(Column2) Or IsNull(Column3) Or IsNull(Column4)) Then 'N' Else If (Column1= 'Y' AND Column2= 'Y' And Column3= 'Y' AND Column4= 'Y') then 'Y' else 'N'
Code: Select all
If (Column1= 'Y' AND Column2= 'Y' AND Column3= 'Y' AND Column4= 'Y' then 'Y' else 'N')
However, I always advocate handling NULL explicitly, if for no other reason than to communicate to the next developer that I've considered it.
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.
Re: In Informix DataBase condtion for NULL value getting fai
In Data Stage Transformation following condition given
IF Trim (gender) = 'Male' OR Trim (gender) = 'Female' OR Trim (gender) = 'Indeterminate' THEN 'Y' ELSE 'N'
Source: Table 1
Column Nullable
Gender No
Target: Table 2
Column Nullable
Sex Yes
Please let me know how some of the row of Table 2 getting null values.
IF Trim (gender) = 'Male' OR Trim (gender) = 'Female' OR Trim (gender) = 'Indeterminate' THEN 'Y' ELSE 'N'
Source: Table 1
Column Nullable
Gender No
Target: Table 2
Column Nullable
Sex Yes
Please let me know how some of the row of Table 2 getting null values.
prasoon wrote:Hi
In DS I given following condition
If (Column1= 'Y' AND Column2= 'Y' AND Column3= 'Y' AND Column4= 'Y' then 'Y' else 'N')
But when ALL the column's getting NULL value then in Target Table updating with NULL value. According to my requirement It should be either 'Y'(if Condition thru) or 'N'
Due to this problem most of the record not updating in target Table!!
Please suggest me How I can solve this problem.
Regards,
Prasoon
Prasoon
-
- Premium Member
- Posts: 108
- Joined: Sat Feb 05, 2005 6:52 pm
- Location: US
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Where is the source coming from? Just because you declare a column to be not null in your DataStage job does not enforce non-nullability. For example, if your source is a text file, the Format tab on the Sequential File stage specifies what will be interpreted to be null (by default it is "") and this is irrespective of the nullability setting for that column. You can override the definition of null representation for particular columns in the Columns grid. Scroll to the right to find it. Replace the empty string with something else, such as "<NULL>".
Post number 11111
Post number 11111
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.
-
- Participant
- Posts: 232
- Joined: Fri Sep 30, 2005 4:52 am
- Contact:
What is the target column datatype?
What if some of the input fields comes as expetec (is it getting populated with either 'Y' or 'N')?
What if you try
What if some of the input fields comes as expetec (is it getting populated with either 'Y' or 'N')?
What if you try
Code: Select all
IF (Trim(gender) = "Male" OR Trim(gender) = "Female" OR Trim(gender) = "Indeterminate") THEN 'Y' ELSE 'N'
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
1.Target column datatype is CHAR
2.other column are populatting according to condition.
3.I'm using following condition
IF (Trim(gender) = "Male" OR Trim(gender) = "Female" OR Trim(gender) = "Indeterminate") THEN 'Y' ELSE 'N'
2.other column are populatting according to condition.
3.I'm using following condition
IF (Trim(gender) = "Male" OR Trim(gender) = "Female" OR Trim(gender) = "Indeterminate") THEN 'Y' ELSE 'N'
kumar_s wrote:What is the target column datatype?
What if some of the input fields comes as expetec (is it getting populated with either 'Y' or 'N')?
What if you tryCode: Select all
IF (Trim(gender) = "Male" OR Trim(gender) = "Female" OR Trim(gender) = "Indeterminate") THEN 'Y' ELSE 'N'
Regards,
Prasoon
Prasoon
Ooff... a quick response...
Are you sure you are lookin after the output directly after the transformation and not after any join or merge where the null will play a vital role.
Try using debugger to know rows wise processing.
Are you sure you are lookin after the output directly after the transformation and not after any join or merge where the null will play a vital role.
Try using debugger to know rows wise processing.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Sorry Kumar for late response....
Ok Now I got the reason why data is not updating those record.
In that job near about 12 Transformation using I was concentrated only on derivation given on Transformation.
But Problem is from source table only data is not fetching for those 268 record among 23458690 record.
I have to look on that only!!
Thanks a lot for support kumar!!
Ok Now I got the reason why data is not updating those record.
In that job near about 12 Transformation using I was concentrated only on derivation given on Transformation.
But Problem is from source table only data is not fetching for those 268 record among 23458690 record.
I have to look on that only!!
Thanks a lot for support kumar!!
![Smile :)](./images/smilies/icon_smile.gif)
kumar_s wrote:Ooff... a quick response...
Are you sure you are lookin after the output directly after the transformation and not after any join or merge where the null will play a vital role.
Try using debugger to know rows wise processing.
Regards,
Prasoon
Prasoon