Hi everyone,

I'm trying to loop through varying size varrays to compare them. How do I do this w/o knowing the size? I thought I could do a for loop from 1.. array.COUNT, but it says it's not declared. (Oracle 8.1.7 and Oracle 9i). I thought COUNT was a predefined collection method.


Could you please post code for this?


Here's my current attempt:



create or replace type array_type as object
(
a1 ARRAY_GROUP,
order member function compare(a2 in array_type) return number
);
/

create or replace type body array_type as
order member function compare(a2 in array_type) return number is
i integer;
begin
FOR i IN 1.. a2.COUNT LOOP
dbms_output.put_line('Whatis i? '|| i);
if a1(i) return -1;
elsif a1(i)>a2.zones(i) then
return 1;
else
return 0;
end if;
END LOOP;
end;
end
;
/