Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

BULK COLLECT & DYNAMIC SQL

258794Jul 15 2005 — edited Jul 19 2005
Hi,

I was able to use just plain loops to get my data but for one user it took several hours and then the temp tblspace couldn't extend. I am trying to use advanced pl/sql bulk binds etc but am getting an error as follows on the EXECUTE IMMEDIATE line:

PLS-00801 internal error [74301].

I know I checked the number out and says to contact oracle. I believe with some adjustment that this will go away.

Here is my code below. Could someone please take a look at it and make some suggestions??

My eyes are glazing over reading documentation and staring at this thing. Thanks for all your help in advance.

al

DECLARE

TYPE c1_cur IS REF CURSOR;
c1_cv c1_cur;

TYPE owner_t IS TABLE OF all_tab_columns.owner%TYPE
INDEX BY BINARY_INTEGER;

seclb_v integer;
cnt_v integer;

own_v owner_t;
table_v owner_t;

BEGIN

OPEN c1_cv FOR SELECT owner, table_name FROM tt_owname
WHERE owner = ‘A’;

LOOP
FETCH c1_cv BULK COLLECT INTO own_v, table_v;
EXIT WHEN c1_cv%NOTFOUND;
END LOOP;

FORALL i IN table_v.FIRST..table.LAST

EXECUTE IMMEDIATE <==ERRORS HERE
‘SELECT COUNT(LABEL), LABEL
FROM ‘||own_v(i)||’.’||table_v(i)
‘ GROUP BY LABEL’;

DBMS_OUTPUT.PUT_LINE(own_v(i)||’.’||table_v(i)||’ ‘||’has’||’ ‘||cnt_v||’ ‘||row(s) of’||’ ‘||seclb_v);

/* Later I will replace the put_line with an insert
statement. */

END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 16 2005
Added on Jul 15 2005
8 comments
703 views