Subject Re: IN function
Author yartax1
--- In firebird-support@yahoogroups.com, Dmitry Yemanov <dimitr@...>
wrote:
>
> yartax1 wrote:
> >
> >> select * from table
> >> where ',' || :mylist || ',' containing ',' || field_integer || ','
> >
> > 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.
>
> Nope. You used commas as separator values and I just followed your
> convention. My example would be easier to understand with another
> separator character, e.g.:
>
> :mylist = '~123~345~342~';
> select * from T where :mylist containing '~' || field_integer || '~'
>
> so '~123~345~342~' is evaluated against values of '~1~', '~12~',
'~123~'
> and only the latest one will give you a match.
>
>
> Dmitry
>
Aja!, better with your explanation!

I was mistaked reading containing operator. I switched pattern value
with match value:

<containing_predicate ::=
<psql_match> [ NOT ] CONTAINING <psql_pattern>

<match> ::= <psql_expr>

<pattern> ::= <psql_expr>

Thanks for all.