Subject Re: [IBO] :PARAM inside function call not working!
Author Helen Borrie
At 10:24 PM 8/06/2005 +1000, you wrote:
>At 01:09 PM 8/06/2005 +0200, you wrote:
> >Robert Osowiecki wrote:
> >
> > >CAST did not help either...
> > >
> > >
> > >
> >And BDE returns similar error.
> >R.
>
>Well, I'm not certain that it's possible to pass the input to a UDF as an
>SQL parameter. I just don't know how the prepare would know what it was
>dealing with. I'll try to test it and report back.

Well, as far as I can tell, it is *not* possible to fool the engine that
your parameter could be something it knows about. You can pass either
constants or expressions that resolve as constants to UDFs. An expression
with an unknown "something" in it is neither of these things.

I'm curious about what you think would be returned by your statement,
actually. To me, it looks like a statement which (if passed a valid
argument) will return either an empty set or all of the rows in the table,
regardless of what your UDF actually does:

SELECT * from ARTICLEDATA
where (my_udf_function(ar_code, 'anything at all')=0)

the where clause will be either

where 0=0

or

where 987654=0 (987654 being some arbitrary integer)

In the first case (0=0) is always true, so you will get all of the rows in
the table. In the second (AnyNonZeroInteger=0) is always false, so you
will get no rows.

Or quite possibly I'm just totally missing something, altogether possible
at this time of day. :-)

Helen