Thursday, January 9, 2014

Collections and records

-- VARAAY type and TABLE type.
-- VARAAY  has max length but TABLE does not have max length constraint.
-- Both are type of record and stored based on index.

declare

type varr_var is varray(10) of integer;
type tab_var is table of integer;
t_vrr tab_var;
v_arr varr_var;
cnt integer;

begin
v_arr:=varr_var(10,11,12,13,14,15,16,17,18);
cnt:=v_arr.count;
for i in 1..cnt loop
dbms_output.put_line(v_arr(i));
end loop;
t_vrr:=tab_var(30,31,32,33,34,35,36,37,38,39,40,41,42,53,45,23,37);
cnt:=t_vrr.count;
for i in 1..cnt loop
dbms_output.put_line(t_vrr(i));
--dbms_output.put_line('Anand   '||i||cnt);
end loop;
end;
/

No comments:

Post a Comment