Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: simulating a temp table
On Thu, 19 Feb 1998 23:26:20 GMT, ckincy_at_pitc.com (Chuck Kincy) made a complete ass of himself:
> WHILE i IS NOT NULL AND NOT found LOOP
> found := r.object_name = tmptab(i);
> i := tmptab.NEXT(i);
> END LOOP;
> IF found THEN
> tmptab.DELETE(i);
> END IF;
This is stupid, try this instead:
set serveroutput on size 1000000
DECLARE
TYPE tmptab_t IS TABLE OF VARCHAR2(100) INDEX BY BINARY_INTEGER;
tmptab tmptab_t;
CURSOR c_all_objects IS
SELECT object_name
FROM all_objects;
i NUMBER; found BOOLEAN;
tmptab(0) := 'DBA_TABLES'; tmptab(1) := 'V$PARAMETER'; tmptab(2) := 'WILL_NOT_BE_FOUND'; tmptab(3) := 'ALL_USERS'; FOR r in c_all_objects LOOP found := FALSE; i := tmptab.FIRST; WHILE i IS NOT NULL AND NOT found LOOP found := r.object_name = tmptab(i); IF found THEN tmptab.DELETE(i); ELSE i := tmptab.NEXT(i); END IF; END LOOP;
DBMS_OUTPUT.PUT_LINE( tmptab(i) ); i := tmptab.NEXT( i );
/cpk Received on Fri Feb 20 1998 - 00:00:00 CST
![]() |
![]() |