declare
TYPE table1Type is TABLE OF table1%ROWTYPE
index by binary_integer;
v_results table1Type ;
begin
v_sql := 'SELECT *
FROM table1@' || v_dblink || '
WHERE mydate_dttm > sysdate - 1';
EXECUTE IMMEDIATE v_sql BULK COLLECT INTO v_results;
end;
That's it... This loaded all of the records into the v_results PL/SQL table and you can loop through the results like a array.
2 comments:
where is db_link defined?
That was a left over from the cut and paste. The original package had the v_dblink set to the dblink name for that instance which was retrieved from the database. Just replace the variable with your link name or if you don't need a dblink (IE: just using one database) remove the dblink variable.
Let me know if you still have questions.
Brian
Post a Comment