I have 1 table with 500k records records and for each record in the table I would like to query an oracle package and return the rows from this query. How can I do this with PL SQL ORACLE?
I tried to do it here:
declare
cursor c_t is select COLUM_TABLE from SCHEMA.COMPANY;
szSql varchar2(2048);
begin
for rec in c_t loop
szSql := 'SELECT * FROM SCHEMA.PKG_COMPANY.GET_DATA_COMPANY('||rec.COLUM_TABLE||')';
dbms_output.put_line(szSql);
execute immediate szSql;
end loop;
end;
I would like to know how to return the data as a common query and if there is a more performant way to do it.
Could you help me with examples?
EDIT When I call the package, I get the following return:
This data is the result of a complex query that the package makes
ID_COMPANY | REGION | LATITUDE | LONGITUDE | DENSITY | COUNTRY | ROLE
1. WEST. -0110110. -0110110. 22. EUA. SUBS