Non Nullable to Nullable using Modify stage

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
khanparwaz
Participant
Posts: 60
Joined: Tue Jul 12, 2005 3:34 am

Non Nullable to Nullable using Modify stage

Post by khanparwaz »

Hi,

I have a non nullable field in source. But in target this field is non nullable. I want to make it non nullable using modify stage. Currently this is achieved using transformer stage. Also if the value of the field in source is '' then i want to set it to null in target. I could find nullable to non nullable handling using handle_null functions but i want the reverse.
Can anyone help.

Thank In Advance.
ashwin141
Participant
Posts: 95
Joined: Wed Aug 24, 2005 2:26 am
Location: London, UK

Re: Non Nullable to Nullable using Modify stage

Post by ashwin141 »

khanparwaz wrote:Hi,

I have a non nullable field in source. But in target this field is non nullable. I want to make it non nullable using modify stage. Currently this is achieved using transformer stage. Also if the value of the field in source is '' then i want to set it to null in target. I could find nullable to non nullable handling using handle_null functions but i want the reverse.
Can anyone help.

Thank In Advance.
Hi

You want to do non nullable to nullable or
nullable to non nullable?

Ashwin
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Probably Missing out someting :?
If your target is not nullable, you cannot assign null to the column. If you input is not nullable, you cannot get null from the source.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
khanparwaz
Participant
Posts: 60
Joined: Tue Jul 12, 2005 3:34 am

Non Nullable to Nullable using Modify stage

Post by khanparwaz »

Hi,

My mistake. Source is Non-Nullable and Target is Nullable.

In the join stage if the join is outer and if the condition fails then the fields which are non nullable will have '' values.
In the target, if such values are nullable i want to assign Null to these fields.

eg If field1 = '' then SetNull else field1

But in the specification of Modify stage i can not use if then else...

Any idea how to achieve this...

Thanks in advance...
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

What is the output stage. If it is sequential file stage, try to play with "Nullable field value" and "Default value", I guess you can acheive your need, using these option. And can avoid Modify stage as well. I dont have access right now, will let you now later.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
benny.lbs
Participant
Posts: 125
Joined: Wed Feb 23, 2005 3:46 am

Post by benny.lbs »

khanparwaz,

Maybe you can try the following

After join stage, add Filter stage to filter into two links, one with '' values, the other without. Then add Modify stage after the link with '' values, and set the specification to be "field = make_null(field, "")". Then combine these two links with Funnel stage.

Is it what you wanted ?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What about simply targetfield:nullable integer=sourcefield ?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
benny.lbs
Participant
Posts: 125
Joined: Wed Feb 23, 2005 3:46 am

Post by benny.lbs »

It seems his requirement not only to change the nullability, but also want to set NULL.
ray.wurlod wrote:What about simply targetfield:nullable integer=sourcefield ? ...
khanparwaz
Participant
Posts: 60
Joined: Tue Jul 12, 2005 3:34 am

Non Nullable to Nullable using Modify stage

Post by khanparwaz »

benny.lbs wrote:It seems his requirement not only to change the nullability, but also want to set NULL.
ray.wurlod wrote:What about simply targetfield:nullable integer=sourcefield ? ...
Yes I want to set the field to Null if its ''.
Post Reply