I have a very beginner knowledge on SQL and trying to get this work for a couple days but no luck unfortunately.
I have a PL/SQL block code like this..
BEGIN
For i in (SELECT 'SELECT * FROM ' || ACTIVE_POD || '.userservice' AS QUERY
FROM active_tables) loop
dbms_output.put_line(i.query);
end loop;
END;
This will output
SELECT * FROM DB1.userservice
SELECT * FROM DB2.userservice
....
SELECT * FROM DB99.userservice
What I want to get is union of all above query outputs into one table. For example) Let's say the union of above output will be three integer columns
ID |item_code|type
10 | 2 |1001
91 | 2 |1005
10 | 2 |1011
I would appreciate any guidance on this. thank you!