SELECT * 
FROM getDocumentReferences 
WHERE 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 * FROM getDocumentReferences WHERE 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')