select count(*) as alias1
From Dual D
WHere exists ( select a.col1, b.col2
From taba a
left outer join tabb b on a.col4=b.col5
where a.col6=2
a.col7=2
a.col8=9
and b.col7=8)
)
cette requete (oracle 9ir2) retourne 1 si le contenu de la sous requete ramene 1 ou plusieurs lignes .
retourne 0 sinon
Voici son plan d''execution
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1982 Card=1)
1 0 SORT (AGGREGATE)
2 1 FILTER
3 2 TABLE ACCESS (FULL) OF 'DUAL' (Cost=1982 Card=1)
4 2 TABLE ACCESS (BY INDEX ROWID) OF 'Tabb' (Co
st=2 Card=1 Bytes=56)
5 4 NESTED LOOPS (Cost=3 Card=1 Bytes=97)
6 5 TABLE ACCESS (BY INDEX ROWID) OF 'taba' (Cost=2 Car
d=1 Bytes=41)
7 6 INDEX (RANGE SCAN) OF 'INN_taba_10' (NON-UNIQUE)
(Cost=4 Card=2)
8 5 INDEX (RANGE SCAN) OF 'AK_Tabb' (NON-UNIQUE) (Cost=1 Card=1)
queqlu''un a une idée comment eviter le dual(trop consommateur), le principe est d'afficher le resultat 1 quand il ya des lignesramenées par la sous requete et 0 sinon.
Merci d'avance!!!
Partager