Page 1 of 1

How to convert nullable Column to Non Nullable Column?

Posted: Thu May 01, 2008 8:27 am
by jimgowtham
Hi,

I have 4 column's which is of Nullable "NO", Is there any way to change this to Nullable "YES"...?

Regards,
JIM

Re: How to convert nullable Column to Non Nullable Column?

Posted: Thu May 01, 2008 8:48 am
by DS1
have you tried using modify stage.

Posted: Thu May 01, 2008 9:07 am
by jimgowtham
Yes I tried with modify stage and I am getting following error...

Modify_506: When checking operator: When binding output schema variable "outRec": When binding output interface field "PLANT_IDENT_CD" to field "PLANT_IDENT_CD": Null value handling is specified with a non-nullable source field and no conversion; ignoring.

I used : PLANT_IDENT_CD = handle_null(PLANT_IDENT_CD, -1)

regards,
JIm

Posted: Thu May 01, 2008 9:16 am
by Dev_India
Try it with Transformer. It will not even give any warning

Posted: Thu May 01, 2008 9:27 am
by ArndW
Do it in a transform stage, but you need to ensure that the new, non-nullable, column doesn't contain any nulls. You can use several null-handling functions to do this.

Posted: Thu May 01, 2008 9:32 am
by jimgowtham
My job is like ...

(PLANT_IDENT_CD) Nullable No

Plt_idt_cd----------- Lkup-------------------->Transformer---->OracleEnt
(Nullable Yes)


From lookup ,I have to convert this PLANT_IDENT_CD to Nullable 'YES' and later it is passed to transformer. When I try change this column to Nullable 'Yes', this is dropped in transformer.

Regards,
jim

Posted: Thu May 01, 2008 9:42 am
by OddJob
The original field is Nullable=NO, meaning the field cannot accept Nulls, and at that point should not contain Null.

Going from Nullable:No to Nullable:Yes does not require any conversion functions, just set the output nullable to Yes in any stage, Copy stage if you like!

Your attempts with the Modify stage are not required.

Obviously, after the null change, the field may now contain Null, so be careful with logic in transformers if the field does have null in it and you're specifically checking, e.g.

if IsNotNull(<Field>) then UpCase(<Field>) else <Field>

If you let Null go through a function like UpCase the row will be dropped by the transformer.

Posted: Thu May 01, 2008 9:43 am
by OddJob
Maybe the confusion occurred with the other posters because the Post title 'How to convert nullable Column to Non Nullable Column?' contradicts the post itself :shock:

Posted: Thu May 01, 2008 9:53 am
by ArndW
Yes, I read the title part and that is why I put my post in. I didn't realize you were going from non to nullable, in which case you can do this in just about any stage.

Posted: Thu May 01, 2008 10:19 am
by jimgowtham
If I do the lookup with "Nullable No" to "Nullable yes" column,
Job was aborted ...So I tried with modify stage to convert this Nullable NO to Nullable YES.

Regard,
jim

Posted: Thu May 01, 2008 2:43 pm
by ray.wurlod
Add a further specification to the Modify stage containing the single word NOWARN.