Following query shows that select *
combined with connect by
and left join
doesn't return all columns, but only columns used in these conditions.
This behavior was useful for me, given that select *
should not be used in release, it is useful requesting for data.
with t1 as (
select 1 id, 0 parent, 'ROOT' name from dual
union all
select 2 id, 1 parent, 'CHILD-1' name from dual
union all
select 3 id, 1 parent, 'CHILD-2' name from dual
), t2 as (
select 1 t1id, 'node' special from dual
)
select * from t1
left join t2 on t2.t1id=t1.id
start with id = 2
connect by prior parent = id;
whereas other queries returns all columns
select * from t1
start with id = 2
connect by prior parent = id;
select * from t1
left join t2 on t2.t1id=t1.id;
I could not found documentation on this functionality, is there any ?
SELECT t1.*, t2.*
works. No idea whySELECT *
doesn't. – CorkerWHERE name IS NOT NULL AND ( special IS NULL OR special IS NOT NULL )
will then mean those columns appear in theSELECT *
. – Corker