The basic structure of what you are asking can be seen below. Please provide additional information for a more specific code example.
DECLARE l_output NUMBER; BEGIN FOR i IN 1..10 LOOP SELECT 1 INTO l_output FROM dual; DBMS_OUTPUT.PUT_LINE('Result: ' || l_output); END LOOP; END;
PS: If you need to include output in SQL * Plus, you may need to run the command
SET SERVEROUTPUT ON
UPDATE
To paste the results into another table:
DECLARE
To create an idea of your results, see the example below:
CREATE VIEW scott.my_view AS SELECT * FROM scott.emp;
To view results using a view:
SELECT * FROM scott.my_view;
source share