0% found this document useful (0 votes)
27 views1 page

Bulkcollect Forall

This procedure takes in a parameter for the array size and uses it to bulk collect rows from the ALL_OBJECTS table in batches of the specified size. It then inserts each collected batch of rows into a table named t. The procedure loops through this process until it has reached the end of the ALL_OBJECTS table.

Uploaded by

Ram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views1 page

Bulkcollect Forall

This procedure takes in a parameter for the array size and uses it to bulk collect rows from the ALL_OBJECTS table in batches of the specified size. It then inserts each collected batch of rows into a table named t. The procedure loops through this process until it has reached the end of the ALL_OBJECTS table.

Uploaded by

Ram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

CREATE OR REPLACE PROCEDURE nrows_at_a_time(p_array_size PLS_INTEGER) AUTHID

CURRENT_USER IS
l_owner dbms_sql.VARCHAR2_table;
l_object_name dbms_sql.VARCHAR2_table;
l_subobject_name dbms_sql.VARCHAR2_table;
l_object_id dbms_sql.NUMBER_table;
l_data_object_id dbms_sql.NUMBER_table;
l_object_type dbms_sql.VARCHAR2_table;
l_created dbms_sql.DATE_table;
l_last_ddl_time dbms_sql.DATE_table;
l_timestamp dbms_sql.VARCHAR2_table;
l_status dbms_sql.VARCHAR2_table;
l_temporary dbms_sql.VARCHAR2_table;
l_generated dbms_sql.VARCHAR2_table;
l_secondary dbms_sql.VARCHAR2_table;

CURSOR c IS
SELECT *
FROM all_objects;
BEGIN
OPEN c;
LOOP
FETCH c BULK COLLECT INTO
l_owner, l_object_name, l_subobject_name, l_object_id,
l_data_object_id, l_object_type, l_created,
l_last_ddl_time, l_timestamp, l_status, l_temporary,
l_generated, l_secondary
LIMIT p_array_size;

FORALL i in 1 .. l_owner.COUNT
INSERT INTO t
(owner, object_name, subobject_name, object_id,
data_object_id, object_type, created, last_ddl_time,
timestamp, status, temporary, generated, secondary)
VALUES
(l_owner(i), l_object_name(i), l_subobject_name(i),
l_object_id(i), l_data_object_id(i),
l_object_type(i), l_created(i), l_last_ddl_time(i),
l_timestamp(i), l_status(i), l_temporary(i),
l_generated(i), l_secondary(i));
EXIT WHEN c%NOTFOUND;
END LOOP;
COMMIT;
CLOSE c;
END nrows_at_a_time;

You might also like