SQL 在分支条件下加入 table

SQL join a table on a branching condition

我正在尝试执行 SQL 连接 "with a twist",类似这样:

SELECT *
FROM a
JOIN b ON /* a.type == 'any' ? b.id IS NULL : b.id = a.id */

其中注释是用类似 C 的语法编写的。如何在SQL中表达我想要的? (最好是 ANSI,但特定于 Oracle 数据库也可以。)

SELECT *
FROM a
JOIN b ON (a.type  = 'any' AND b.id IS NULL) 
       OR (a.type <> 'any' AND b.id = a.id)