SQL “Join” on null values

前端 未结 14 1334
旧巷少年郎
旧巷少年郎 2020-12-13 14:04

For reasons beyond my control, I need to join two tables and I need null values to match. The best option I could think of was to spit out a UUID and use that as my comparis

14条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 14:43

    For this sort of task Oracle internally uses an undocumented function sys_op_map_nonnull(), where your query would become:

    SELECT *
    FROM T1 JOIN T2 ON sys_op_map_nonnull(T1.SOMECOL) = sys_op_map_nonnull(T2.SOMECOL)
    

    Undocumented, so be careful if you go this route.

提交回复
热议问题