Page 1 of 1
Null Value for Integer
Posted: Tue Jul 10, 2007 5:36 am
by Havoc
Hi,
Is there anyway to set the null value for an integer column which is an unmatched row from the update link of a Merge stage(in Keep Mode)? As of now , all integer columns of unmatched rows are set to 0. Is there a way to set this to some other value?
Thanks in advance
![Smile :)](./images/smilies/icon_smile.gif)
Posted: Tue Jul 10, 2007 6:29 am
by devidotcom
Check the nullability on this integer field. If yes then it would give a NULL value
Posted: Tue Jul 10, 2007 7:10 am
by Havoc
Yeah it is a non nullable column. But can I set this null default value to something else? I would like to set the integer value to something other than the DataStage default 0.
Thanks
![Smile :)](./images/smilies/icon_smile.gif)
Posted: Tue Jul 10, 2007 12:23 pm
by ray.wurlod
Code: Select all
NonNullField : int32 = handle_null(InputField, 42)
Forty two is the ultimate answer to life, the universe and everything.
Posted: Tue Jul 10, 2007 1:22 pm
by Havoc
ray.wurlod wrote:Code: Select all
NonNullField : int32 = handle_null(InputField, 42)
Forty two is the ultimate answer to life, the universe and everything. ...
Hmmm ...I would greatly appreciate it if you could elaborate a lil bit more on this Ray.. (not on the The Hitchhiker's Guide to the Galaxy bit
![Wink ;)](./images/smilies/icon_wink.gif)
)
Can i incorporate this in a transformer instead? Basically the job design has a transformer following the merge stage. Is there a way I can go about setting the transformer constraint or if-else rule to check for a value like -3 instead of 0, cause there is a possibility that 0 might actually be a valid value.
Thanks...
Posted: Tue Jul 10, 2007 9:43 pm
by ray.wurlod
In a Transformer stage the equivalent function is NullToValue(). When the lookup fails and the rule is Continue, you get a genuine NULL on the output. If the field is non-nullable you also get a warning, and that field will take its default value, which you can set (for example to -3) in the metadata. Otherwise, make the field nullable and handle the NULL in the downstream Transformer stage.