input Column 0 value to NULL in target

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
anudeepdasari001
Participant
Posts: 58
Joined: Mon Dec 14, 2015 3:16 pm
Location: Arizona

input Column 0 value to NULL in target

Post by anudeepdasari001 »

How to convert source Input value that is 0 to NULL in target DB
anudpETL
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You don't "convert" it so much as replace it with NULL and that should just be an if-the-else derivation or something similar.
-craig

"You can never have too many knives" -- Logan Nine Fingers
anudeepdasari001
Participant
Posts: 58
Joined: Mon Dec 14, 2015 3:16 pm
Location: Arizona

Post by anudeepdasari001 »

That is varchar column in source and date column in target
Database-Oracle
anudpETL
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Makes no difference to what Craig suggested.

You'll need to convert the string to a date if it's valid, otherwise set the value to null. Do these things in a Transformer stage.

Something like:

Code: Select all

If (IsValid(InLink.TheString, "date")) Then StringToDate(InLink.TheString) Else SetNull()
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
skp
Premium Member
Premium Member
Posts: 135
Joined: Wed Dec 26, 2007 1:56 am
Location: India

Post by skp »

Hi,

Use below logic.

If Trim(Input_Column)=0 Then SetNull() Else Input_Column
Post Reply