解释 Oracle SQL where ('a','b') in (('x', 'y')) 的语法

Explain syntax of Oracle SQL where ('a','b') in (('x', 'y'))

在 Oracle SQL 中不接受这种语法,returns ORA-00920: invalid relational operator

  select name
      from employees
     where (emp_id, dept_id) in (1 , 100)
        or (emp_id, dept_id) in (2, 200)
     order by emp_id;

虽然这个语法看起来完全有效(注意双括号)

 select name
  from employees
 where (emp_id, dept_id) in ((1 , 100))
    or (emp_id, dept_id) in ((2, 200))
 order by emp_id;

你能解释一下为什么吗?我没有在 Oracle 文档中找到任何对此语法的引用。

我想你想要:

select name
from employees
where (emp_id, dept_id) in ((1, 100), (2, 200))
order by emp_id;

问题是您正在比较元组。元组需要用括号括起来。