PL/SQL (MOSC)

MOSC Banner

how to clear a variable?

edited Sep 13, 2013 3:55AM in PL/SQL (MOSC) 7 commentsAnswered
See following sample code, how do I reset or clear  v_testtable for next loop fetch?
Thanks


declare
TYPE testtable2_aat IS TABLE OF testtable2%ROWTYPE  INDEX BY PLS_INTEGER;
v_testtable2 testtable_aat;

begin
  loop -- main loop here
      -- exit main loop condition test here
select 
1,2,3,4,5
BULK COLLECT INTO 
v_testtable
from 
testtable
        where ....
;

dbms_output.put_line(nvl('1 '||v_testtable.last,-1));

FORALL i IN v_testtable.first..v_testtable.last 

INSERT INTO testtable2
VALUES v_testtable2(i);

  commit;

-- *******
-- Need to clear the variable
-- both following not work
v_testtable2 := null;
clear all from v_testtable2 ;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center