| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Using a parameter with an IN clause?
Just a general question.
With the following table called 'test' (ID is numeric, Name is text):
Id Name
= ====
1 Red
2 Green
3 Blue
the following sql: 'SELECT Id, Name FROM test WHERE Id In ([p])'
works very well if a single number is used when run (e.g p is made equal to
2). Of course the query 'SELECT Id, Name FROM test WHERE Id In (1,2)' works
well, but when a comma-separated list is passed to the query (e.g. 1,2) it
doesn't work.
So the question is: why does a comma-separated list work when hard-coded,
but not when used with a parameter?
Thanks in advance for any assistance possible.
Received on Wed Jan 23 2002 - 20:54:49 CST
![]() |
![]() |