Click here to Skip to main content
15,900,108 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Any ideas on how to do a multi-column IN clause? Note that the comparison set is coming from application memory, not a subquery in Oracle. So, for example, I have two arrays, IDs() and Names(), and I want to get something like this:
SQL
SELECT * FROM MY_TABLE WHERE (ID, NAME) NOT IN (:IDs, :Names) 

Most common error I've been getting is "invalid relational operator".

Open to other suggestions. I'd like to avoid building an ugly query like
SQL
SELECT * FROM MY_TABLE WHERE (ID, NAME) NOT IN ((ID1,Name1), (ID2,Name2), ...) 

or even worse,
SQL
SELECT * FROM MY_TABLE WHERE (ID || NAME) NOT IN (:IDNames) 
Posted

Previously you have to select ids which you want to neglet/omit then push that ids into temp table and then filter records using temp table ids

here sample code
SQL
DECLARE @TempTable TABLE (Ids int)

insert into @TempTable(Ids)
select StudentIdid from StudentTable where StudentId<10
  
select StudentId,StudentName from StudentTable where StudentId not in (select Ids from @TempTable)


i hope you understand...
 
Share this answer
 
You can use dynamic views
click here2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900