SELECT distinct * 
FROM getProductReferences 
Where idProdReg = 98 And
idProdStruc = 362152 AND 
idDocStrucF IN (SELECT idDocStrucF FROM docStrucRel START WITH docStrucRel.idDocStrucF = 31053 
CONNECT BY PRIOR docStrucRel.idDocStrucF = docStrucRel.idDocStrucT) and iWhatToShow in(1,2,4,8,16,32,64,128,256,512,1024) AND
to_char(dateTo, 'YYYY-MM-DD HH24:MI:SS') >= to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS') 
UNION SELECT distinct * 
FROM getProductReferences
Where idProdReg = 98 And idProdStruc = 362152 AND 
idDocStrucT IN (SELECT idDocStrucF FROM docStrucRel START WITH docStrucRel.idDocStrucF = 31053 
CONNECT BY PRIOR docStrucRel.idDocStrucF = docStrucRel.idDocStrucT) and iWhatToShow in(1,2,4,8,16,32,64,128,256,512,1024) AND
to_char(dateTo, 'YYYY-MM-DD HH24:MI:SS') >= to_char(sysdate, 'YYYY-MM-DD HH24:MI:SS')