Oracle sql - 这里代表什么(+)

时间:2017-12-06 01:37:26

标签: sql oracle

我知道(+)可以用来表示oracle sql中的外连接。 这段代码中的(+)是什么意思?

where sysdate between start_date(+) and end_date(+) 

1 个答案:

答案 0 :(得分:1)

它允许外部联接到"幸存" where子句条件。即它还允许返回NULL。例如下面

select *
from from_table ft, outer_table ot
where sysdate between ot.start_date(+) and ot.end_date(+) 
and ft.id = ot.ft_fk(+)

等效的可能是:

select *
from from_table ft
left join outer_table ot on ft.id = ot.ft_fk and sysdate between ot.start_date and ot.end_date

或者,等同于:

select *
from from_table ft
left join outer_table ot on ft.id = ot.ft_fk
where (sysdate between ot.start_date and ot.end_date OR ot.start_date IS NULL)
相关问题