Not Null date in source being recognized as null

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
logic
Participant
Posts: 115
Joined: Thu Feb 24, 2005 10:48 am

Not Null date in source being recognized as null

Post by logic »

Hi,
I am selecting some data from oracle table using user defined query through DRS stage. While selecting I am masking the date column with

Code: Select all

TO_CHAR(T1.IN_DT, 'YYYY-MM-DD HH24:MI:SS'). 
The date in source is 5/19/1997 , for example. In the transform for that column I have

Code: Select all

If IsNull(LINK_In_Txn2.IN_DT) or " " Then "1900-01-01 00:00:00" Else LINK_In_Txn2.IN_DT
.
I see the date in correct format if i view data at source or run the query outside datasatge. However the same date is written into the output sequential file as 1900-01-01 00:00:00. :(
Can anybody give a clue as to what might be happening or what might be causing this.
Thanks.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Try

Code: Select all

If IsNull(LINK_In_Txn2.IN_DT) Or Trim(LINK_In_Txn2.IN_DT) ="" Then "1900-01-01 00:00:00" Else LINK_In_Txn2.IN_DT
HTH
Kris

Where's the "Any" key?-Homer Simpson
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Code: Select all

If IsNull(LINK_In_Txn2.IN_DT) or LINK_In_Txn2.IN_DT = " " Then "1900-01-01 00:00:00" Else LINK_In_Txn2.IN_DT
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

If you are going for a user defined SQL, you might as well throw in a case statement in the sql itself and do this manipulation there.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
logic
Participant
Posts: 115
Joined: Thu Feb 24, 2005 10:48 am

Post by logic »

Thanks all,
Worked perfect.
Post Reply