Subject RE: [firebird-support] In() Question
Author Ruben (Mon Mariola)

Hello,

 

I honestly do not finish understanding the searches you want to do, but maybe a little trick will help. Search ',' || : varname || ',' in the expression ',' || list || ','.

 

For example:

 

select * from table where ',' || list || ',' starting with ',' || :varname || ','; -- starting

select * from table where position(',' || :varname || ',' in ',' || list || ',') > 0; -- containing

select * from table where ',' || list || ',' like '%,' || :varname || ','; -- ending

select * from table where ',' || list || ',' like ',' || :varname || ',%'; -- starting

select * from table where ',' || list || ',' like '%,' || :varname || ',%'; -- containing

 

Ruben.

 


De: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Enviado el: miércoles, 31 de enero de 2018 10:09
Para: firebird-support@yahoogroups.com
Asunto: [firebird-support] In() Question

 

 

Hello @ll,

 

I have a configuration table with stations, who can be only one order active and stations, where it isn’t so. The list contains all stations, who only one order can be active. For example, if there an order in station 2, the user cannot start an order on station 1, 2 and 3. On stations 4 it isn’t so, on station 5 only station 5 will be checked.

 

Please not with a sql statement.

 

Station, onlyone, list

1                 1        1,2,3

2                 1        1,2,3

3                 1        1,2,3

4                 0

5                 1        5

6                 0

 

The sql where station in(1,2,3) works, but not if there an variable where station in(:varname). An cursor message occurs.

 

How can I solve this? Perhaps per sql where station, the current station is 2 for example (..where station in (select station from table where onlyone …ends to 1 from 2 to 1 and ..onlyone ends while 1 is ending (station 4)..?

 

Thank you.