These are my tables and sample records:
DEPARTMENT.Dept_nbr (VARCHAR)
---------------------
(NULL)
UNK
00309
309
FPLAN.Department (NUMBER)
---------------------
D0309
Scenario:
I want FPLAN.Department (D0309) to be the reference and will display DEPARTMENT.Dept_nbr values.
My code:
select
TRIM(REPLACE(FPL.DEPARTMENT, 'D')) as DEPARTMENT , DEPT.*
from
FPLAN FPL ,
(
select distinct(TRIM(LEADING 0 FROM DEPT_NBR)) DEPT_NBR from DEPARTMENT
) DEPT
WHERE
TRIM(LEADING 0 FROM FPL.DEPARTMENT) = DEPT.DEPT_NBR;
This brings NO RESULT.
What do I need to do to get this DEPT_NBR:
00309
309