If you're looking to do this for ad hoc queries, this can be done with a WITH query:
WITH
UserList AS
(
SELECT 'UserID1' AS UserID FROM DUAL UNION ALL
SELECT 'UserID2' AS UserID FROM DUAL UNION ALL
...
SELECT 'UserIDX' AS UserID FROM DUAL
)
SELECT t.*
FROM table t
JOIN UserList U
ON t.UserID = U.UserID
That list in between the parentheses of the UserList WITH query can be as long as you want it to be, and can pretty easily be created with Excel (assuming that's where the list you want to check originated).
-
Example Excel formula (assuming your first value is in A2):
="SELECT '" & A2 & "' AS UserID FROM DUAL" & IF(A3="", "", " UNION ALL ")
or, if your UserID is numeric:
="SELECT " & A2 & " AS UserID FROM DUAL" & IF(A3="", "", " UNION ALL ")
(autofilling this down to the bottom of your list will create everything you need to paste in between the parentheses of that query above)
-
HOWEVER, note that this is only good for ad hoc type queries. This is not a good solution if you need to do this on an automatic basis. If this is for a more permanent solution, use temp (or permanent) tables.
Edit Starts Here
Here is some simple code that shows how to do this in ColdFusion
<cfset ids = "1,2">
<cfquery name="x" datasource="oraclesomething">
with IDList as (
select 0 id
from dual
where 1 = 2
<cfloop list="#ids#" index="ThisID">
union
select #ThisID# id
from dual
</cfloop>
)
select count(*) from some_table join IDList on someid = id
</cfquery>
<cfdump var="#x#" metainfo="no">