Oracle
 sql >> Base de Dados >  >> RDS >> Oracle

Oracle FETCH FIRST 1 ROW com a instrução UNION ALL


Basta colocar cada parte entre parênteses. Funciona em 12.2, de qualquer maneira:
( Select * From tabl1 where Date = '04-MAR-2020' FETCH FIRST 1 ROW )
UNION ALL
( Select * From tabl1 where Date = '05-MAR-2020' FETCH FIRST 1 ROW )

Minha consulta de teste real, para qualquer pessoa interessada, foi esta:
(select   object_name 
 from     user_objects 
 where    object_type = 'TABLE' 
 order by object_name 
 fetch first 1 row only)
UNION ALL
(select   object_name 
 from     user_objects 
 where    object_type = 'VIEW' 
 order by object_name 
 fetch first 1 row only);