Select Into a temp table in DB2
Without an order by your query does not really make sense (IMHO). But nevertheless you can still use a query like:

select * from 
( select A.x 
  from A 
  order by x
  fetch first 2 rows only
)  
union all
(  select B.x 
   from B
   order by x
   fetch first 3 rows only
)  
; 


I made up a small example for you to play with at Fiddle