Page 1 of 1

Regarding NULL

Posted: Fri Dec 30, 2005 6:52 am
by sekr
Hi frnds !

i want to know wethere !

1) Trim(input," ","B") gives the result empty i.e "",
whether this "" equals to @Null..


so if it is Same can we specify Trim(input," ","B") = @Null

so, ""=@null specify yes or no

Posted: Fri Dec 30, 2005 7:17 am
by ArndW
sekr,

why haven't you tested this yourself? You can go into the Manager and create your own DataStage routine and test it with your question all within a minute...

The answer is that the output from TRIM() on any string that is not null will also be not null. In your example it will be the empty string "", of length 0. This same approach applies to all DataStage builtin functions - you won't get a NULL as an answer unless one of your inputs was also a NULL value.

Posted: Fri Dec 30, 2005 4:42 pm
by ray.wurlod
1. Trim() never results in a zero-length string.

2. A zero length string ("") has a known value. Null is unknown. You can never claim that they are equal (or even unequal).

Posted: Fri Dec 30, 2005 8:21 pm
by chulett
ray.wurlod wrote:Trim() never results in a zero-length string.
Never? I was under the impression that if I trim a string with all spaces I would end up with a zero-length string. And testing seems to hold that out, unless something else is going on:

Code: Select all

Len(Trim("      "))
Returns a zero. :?

Posted: Fri Dec 30, 2005 8:46 pm
by kumar_s
I guess Ray ment to say, Trim() can never retrun NULL.

-Kumar