>>Some experimentation with your sample code showed that the function is called for everytime it appears in the select. If you remove one of them you get two firings, with two of them you get 6 firings (I can't account for the extra two firings).
>
>However, it always produces the correct results in the resulting cursor, which reinforces something that I have said in my classes for a long time; "The only thing that you can depend on about how SQL SELECT will produce its result is that it will produce its result." IOW, you cannot depend on anything about number of functions calls, selected work areas, table alias names, record pointer positions, or anything else about the internal behavior of a SELECT query.
>
>This is the reason that using UDF's in SELECTs is cautioned in the docs.
PMFKI, I found through trial and error that having a concatenated string after the function call causes the the function to be called twice for whatever reason. Taking it out brings it down to the expected number of times (4).
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao