Page 1 of 1

Empty String rejection in Oracle

Posted: Wed Feb 16, 2005 4:36 pm
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.

Posted: Wed Feb 16, 2005 5:14 pm
by rasi
Anand

Make it simple.

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

Thanks

Re: Empty String rejection in Oracle

Posted: Wed Feb 16, 2005 5:27 pm
by chalasaniamith
Hi Anand
If IsNull(Arg1) then
Ans="NA "
End Else
Ans=Arg1
End

this will work check this one.

Posted: Wed Feb 16, 2005 5:35 pm
by anandkumarm
Hi,

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

Thanks,
Anand.

Posted: Wed Feb 16, 2005 10:23 pm
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.