Oracle (+) Notation – How to Use Within Functions

join;oracle

If we use (+) notation we can have outer join. For example:

select *
from tab_a, tab_b
where tab_a.num = tab_b.num(+)

Is outer join.
If we use function around columns, for example:

select *
from tab_a, tab_b
where round(tab_a.num, 2) = round(tab_b.num(+), 2)

Is it still outer join? Or is it becomes inner join?

Best Answer

Is it still outer join? Or is it becomes inner join?

It is still an outer join:

SQL Fiddle

Oracle 11g R2 Schema Setup:

create table tab_a(num integer);
create table tab_b(num integer);

insert into tab_a(num) values(1);
insert into tab_a(num) values(2);

insert into tab_b(num) values(2);
insert into tab_b(num) values(3);

Query 1:

select *
from tab_a, tab_b
where tab_a.num = tab_b.num(+)

Results:

| NUM |    NUM |
|-----|--------|
|   2 |      2 |
|   1 | (null) |

Query 2:

select *
from tab_a, tab_b
where round(tab_a.num, 2) = round(tab_b.num(+), 2)

Results:

| NUM |    NUM |
|-----|--------|
|   2 |      2 |
|   1 | (null) |