Empty String rejection in Oracle

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
anandkumarm
Premium Member
Premium Member
Posts: 55
Joined: Tue Feb 24, 2004 8:17 am

Empty String rejection in Oracle

Post by anandkumarm »

Hi All,

I am getting an empty value in a field from Binary EBCDIC flat file. When I tried to load it into an Oracle table it says that its a null value and rejects the value. I tried writing a simple transform function to identify whether the incoming value is empty or null and tried replacing it with standard value. Here is my function

If (IsNull(Arg1) Or (Arg1="") Or (Arg1=@NULL) Or (Arg1=@NULL.STR) or (Trim(Arg1)=" ") Or (LEN(TRIM(Arg1)) = 0) ) then
Ans="NA "
End Else
Ans=Arg1
End

and its not working. Can anybody tell me where I am doing the mistake?

Thanks,
Anand.
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Anand

Make it simple.

If LEN(TRIM(Arg1)) > 0 then
Ans='Arg1
End Else
Ans="NA "
End

Thanks
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
chalasaniamith
Participant
Posts: 36
Joined: Wed Feb 16, 2005 5:20 pm
Location: IL

Re: Empty String rejection in Oracle

Post by chalasaniamith »

Hi Anand
If IsNull(Arg1) then
Ans="NA "
End Else
Ans=Arg1
End

this will work check this one.
anandkumarm
Premium Member
Premium Member
Posts: 55
Joined: Tue Feb 24, 2004 8:17 am

Post by anandkumarm »

Hi,

I tried both ways but still not able to resolve the issue

Thanks,
Anand.
talk2shaanc
Charter Member
Charter Member
Posts: 199
Joined: Tue Jan 18, 2005 2:50 am
Location: India

Post by talk2shaanc »

your incoming string must be containing multiple SPACES, so first TRIM it and then try either your own old method or any of the method suggested in the previous two threads.
Post Reply