Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Using a parameter with an IN clause?

Using a parameter with an IN clause?

From: Andrew Jens <andrewjens_at_hotmail.com>
Date: Thu, 24 Jan 2002 13:54:49 +1100
Message-ID: <3c4f65e5@dnews.tpgi.com.au>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US