I have two tables, ROLE and ROLE_DESC.
ROLE looks like this.
PS_ROLE_SEQ NUMBER,
PS_SEQ NUMBER,
ROLE_TYPE VARCHAR2(2 CHAR),
SOURCE VARCHAR2(128 CHAR)
ROLE_DESC looks like this.
ROLE_TYPE VARCHAR2(2 CHAR),
ROLE_NAME VARCHAR2(16 CHAR)
As you expect, ROLE_TYPE
of ROLE and
ROLE_TYPE
of ROLE_DESC
reference each other. There are three entities in ROLE_DESC
, like this.
ROLE_TYPE ROLE_NAME
A Account
M Manager
S Sales
I would like to print whole role_type
and role_name
by joining two tables even thought ROLE
table does not have a certain ROLE_TYPE
.
For example, if there is no 'S' role_type
for PS_SEQ = 111. I tried, this, but I only got below.
select ROLE_DESC.ROLE_TYPE, ROLE_DESC.ROLE_NAME, ROLE.SOURCE
FROM ROLE_DESC
LEFT OUTER JOIN ROLE
ON ROLE_DESC.role_type=ROLE.role_type
where ROLE.PS_SEQ = 111
Result:
A Account Bob
M Manager Sandy
Actually, I would like to get following.
A Account Bob
M Manager Sandy
S Sales
Does outer join does make it possible? Could you please give some clue for this question?