Subject Re: IN function
Author yartax1
--- In firebird-support@yahoogroups.com, Dmitry Yemanov <dimitr@...>
wrote:
>
> yartax1 wrote:
> >
> > I want to do next query within a procedure:
> >
> > Select * from table where field_integer in ( :mylist )
> >
> > Where mylist is a variable with data as like as '123,345,342'. I
> > suppose that fb considers field as numeric and commas are considered
> > as decimal point.
>
> IN is not supposed to work the way you want it to. Your search
condition
> means the same as just: field_integer in ( '123,345,342' ). This is
> treated as a single value, not as a comma-separated list.
>
> > In any case how can I do a similar where clausule without doing
> > another query or creating a temporal table?
>
> Something like this:
>
> select * from table
> where ',' || :mylist || ',' containing ',' || field_integer || ','
>
> ?
>
>
> Dmitry
>

This expression is a bit difficult to me. If I process the string, it
result like "where ,'123,345,342',containing, field_value" ?!?!. But
it runs semi-OK for me. Containing operator not perform an exact
match. Values 1 and 12 and 123 are match for search value 123.

Other solution can be store in mylist variable the right string as
'123','345','342'. But no idea how to insert single quote into a string.

If no other solution is available, I think the solution is to join
last query with previous query, with the small cost

Thanks.
Yartax.