Is there a function or operator or otherwise a simple (r) construct to get the intersection of two tuple literals in the sql oracle?
Considering the following example:
Availability of the following table
------------------------------ TABLE sometable ------------------------------ id | telephone | mobile | fax ------------------------------ 1 | 123 | 456 | 789
Given a list of n numbers {n1, n2, n3, ..., n} find id, which:
telephone = n1 or mobile = n1 or fax = n1 or telephone = n2 or mobile = n2 or fax = n2 or telephone = n3 or mobile = n3 or fax = n3 .... or telephone = n or mobile = n or fax = n
Two plausible solutions:
1. Solution 1
SELECT id FROM sometable WHERE n1 IN (telephone, mobile, fax) OR n2 IN (telephone, mobile, fax) OR n3 IN (telephone, mobile, fax) .... OR n IN (telephone, mobile, fax) ;
2. Decision 2
SELECT id FROM sometable WHERE telephone IN (n1, n2, n3, ..., n) OR mobile IN (n1, n2, n3, ..., n) OR fax IN (n1, n2, n3, ..., n) ;
However, is there a / operator function to do the following?
SELECT id FROM sometable WHERE intersect_function ( (telephone, mobile, fax), (n1, n2, n3, ..., n) ) = TRUE ;
An alternative, simpler design would be appreciated, given that this condition is part of a longer request with more numerous and possibly more complex conditions.
Thanks.