This is one of the “should be the best way” questions. Let me customize the problem, then I will give you my hacked solution, and perhaps you can offer a better solution. Thanks!
Let's take this little tidbit of PL / SQL
DECLARE TYPE foo_record IS RECORD (foo%type, bar%type); TYPE foo_records IS TABLE OF foo_record INDEX BY PLS_INTEGER; arr_foos foo_records; CURSOR monkeys is SELECT primates FROM zoo; row_monkey monkeys%rowtype; BEGIN FOR row_monkey IN monkeys loop null; END LOOP; END;
It makes sense? I basically need to reset this for something. If it were a number starting from zero, I could just say the number: = 0; at the top of each iteration and run with it. But this is not a number, it is a type that I can simply reset with clean: = 0.
Anyway, to my hack:
DECLARE TYPE foo_record IS RECORD (foo%type, bar%type); TYPE foo_records IS TABLE OF foo_record INDEX BY PLS_INTEGER; arr_foos foo_records; arr_foos_reset foo_records; CURSOR monkeys is SELECT primates FROM zoo; row_monkey monkeys%rowtype; BEGIN FOR row_monkey IN monkeys loop arr_foos := arr_foos_reset; null; END LOOP; END;
I thought that if I manage to keep a member of the same type in its original state, then I can simply return the working variable back to what the original value has. And, surprisingly, this works (I think.) But there has to be a better way. Can anyone help?
T'anks!
oracle plsql
steve
source share