La seguente query mostra che select *
combinato con connect by
e left join
non restituisce tutte le colonne, ma solo le colonne utilizzate in queste condizioni. Questo comportamento è stato utile per me, dal momento che select *
non deve essere utilizzato nel rilascio, è utile per richiedere dati.Oracle select asterisco connect by join sql-92 combination
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;
mentre altre query restituisce tutte le colonne
select * from t1
start with id = 2
connect by prior parent = id;
select * from t1
left join t2 on t2.t1id=t1.id;
non ho potuto trovato documentazione su questa funzionalità, c'è qualche?
'selezionare T1. *, T2. *' Opere.Non ho idea del perché "SELECT *" no. – MT0
e aggiungendo 'WHERE name NON È NULL E '(speciale IS NULL O speciale NON È NULL)' significherà quindi che quelle colonne appaiono in 'SELECT *'. – MT0