'Using single SELECT instead of multiple select in a loop for matching rows

I have a Oracle table with userId and adId (and some other stuff like ad Description, Date Posted etc.). I want to determine if matching userId, adId row exists or not like SELECT * from Ad WHERE userId=xxx and adId=yyy for a list of userId and adId object, e.g. listOf<UserAd>() (using kotlin)

Can I do this in one SELECT statement, instead of looping over UserAd pair in the list and collecting data for which pair the row exists and for which pair it does not? I need to find out for which pair, row exists and for which pair row does not exist.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source