Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IN with string, contained multiple values [CORE3460] #3821

Open
firebird-automations opened this issue May 3, 2011 · 5 comments
Open

IN with string, contained multiple values [CORE3460] #3821

firebird-automations opened this issue May 3, 2011 · 5 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Maxim Kuzmin (cybermax)

Is related to CORE3155

When using WHERE with IN (), for condition allowed only single value (integer or varchar). When using string-condition with multiple values, it's raise exception:
SELECT FROM TABLE 1 WHERE ID IN ('1') -- OK
SELECT FROM TABLE 1 WHERE ID IN ('1, 2, 4, 6') -- EXCEPTION
Also, this behavior does not use string parameters, such as WHERE ID IN (:LIST_ID).

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Link: This issue is related to CORE3155 [ CORE3155 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Unlikely to be accepted, see CORE3155.

@firebird-automations
Copy link
Collaborator Author

Commented by: @krilbe

> SELECT FROM TABLE 1 WHERE ID IN ('1, 2, 4, 6') -- EXCEPTION

Correct syntax is:
SELECT FROM TABLE 1 WHERE ID IN ('1', '2', '4', '6')

> Also, this behavior does not use string parameters, such as WHERE ID IN (:LIST_ID).

Can't do it that way. Try this:

SELECT FROM TABLE 1 WHERE ID IN (:Item1, :Item2, :Item3)

Or dynamically build your in list using string manipulation in your
client app. Or use a temporary table.

@firebird-automations
Copy link
Collaborator Author

Commented by: Maxim Kuzmin (cybermax)

> Or dynamically build your in list using string manipulation in your client app. Or use a temporary table.

Thank you, I use both methods, also a selection from special SP. But it is very inconvenient.

@commanderz
Copy link

commanderz commented Oct 27, 2022

select * from TABLE_1 T1 where position(','||T1.field_id||',',',1,2,11,120,')>0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants