How to convert nullable Column to Non Nullable Column?

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
jimgowtham
Participant
Posts: 34
Joined: Thu Feb 16, 2006 8:34 am
Location: mumbai

How to convert nullable Column to Non Nullable Column?

Post 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
DS1
Charter Member
Charter Member
Posts: 29
Joined: Wed Mar 29, 2006 1:13 pm

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

Post by DS1 »

have you tried using modify stage.
jimgowtham
Participant
Posts: 34
Joined: Thu Feb 16, 2006 8:34 am
Location: mumbai

Post 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
Dev_India
Premium Member
Premium Member
Posts: 9
Joined: Sun May 13, 2007 11:07 am

Post by Dev_India »

Try it with Transformer. It will not even give any warning
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
jimgowtham
Participant
Posts: 34
Joined: Thu Feb 16, 2006 8:34 am
Location: mumbai

Post 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
OddJob
Participant
Posts: 163
Joined: Tue Feb 28, 2006 5:00 am
Location: Sheffield, UK

Post 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.
OddJob
Participant
Posts: 163
Joined: Tue Feb 28, 2006 5:00 am
Location: Sheffield, UK

Post 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:
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
jimgowtham
Participant
Posts: 34
Joined: Thu Feb 16, 2006 8:34 am
Location: mumbai

Post 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
M.Gowthaman,
Accenture Service Pvt Ltd, M2A.
Mobile: +91 9819713784
Ext No: 4323
“Developing Software & Walking through water are easy, if it is frozen..."
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Add a further specification to the Modify stage containing the single word NOWARN.
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