Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register


2
(click on this box to dismiss)

How do I parameterize a SQL IN clause?

I want to parameterize the arguments in the IN clause. I know how to parameterize the "search" field:

SELECT * FROM tbl WHERE ? IN (1,2,3);

But how can I parameterize the arguments to IN without knowing how many there are?

SELECT * FROM tbl WHERE column IN (?)

only allows one parameter to be passed to execution.

link comment (0)
asked 3 years ago
pevensie
54
65 Answers
1

See this answer

In CUBRID, the IN operator is defined as argument IN collection. 

To parameterize the whole IN clause you can write:

SELECT * FROM tbl WHERE column IN ? 

To parameterize only certain elements of the IN clause you can write:

 SELECT * FROM tbl WHERE column IN (1, ?, 2, ?, ?)

link comment (0)
answered 3 years ago
ginarrbrik
516
tagged




You are either using a very old browser or a browser that is not supported.
In order to browse cubrid.org you need to have one of the following browsers:



Internet Explorer: Mozilla Firefox: Google Chrome: