I am opening another thread for the same functionality which i need to achieve using view.
view: create or replace view vw_1 as with data as (select 31059 parent,12345 child from dual union all select null,31059 from dual union all select 31059,41953 from dual union all select null,112 from dual ) select * from data; select * from vw_1 where child = 31059;
DATA:
PARENT
| CHILD |
|---|
| 31059 | 12345 |
| NULL | 31059 |
| 31059 | 41953 |
| NULL | 112 |
expected o/p:
select * from vw_1 where child = 31059 :
parent
| child
|
|---|
| 31059 | 12345 |
| null | 31059 |
| 31059 | 41953 |
| null | 112 |
select * from vw_1 where child = 12345 :
o/p:First record with child 12345
select * from vw_1 where child = 41953
o/p:
Only third record
select * from vw_1 where child = 112
o/p:
only last record.