ARRAY IN ORACLE

declare
type test is table of employees.last_name%type;
alamin test;
v_count number;
begin
alamin:=test('kjkj','skfj','reierl','uuy','uygy8t','ytr65');
v_count:=alamin.count();
for i in 1..v_count loop
dbms_output.put_line(alamin(i));
end loop;
end;


declare
type test is varray(6) of employees.last_name%type;
alamin test;
v_count number;
begin
alamin:=test('kjkj','skfj','reierl','uuy','uygy8t','ytr65');
v_count:=alamin.count();
for i in 1..v_count loop
dbms_output.put_line(alamin(i));
end loop;
end;


declare
type test is table of employees%rowtype index by pls_integer;
alamin test;
v_min number;
v_max number;
begin
select min(employee_id) into v_min from employees;
select max(employee_id) into v_max from employees;
for i in v_min..v_max loop
select * into alamin(i) from employees where employee_id=i;
--v_count:=alamin.count();
--for i in 1..v_count loop
dbms_output.put_line(alamin(i).last_name||'  '||alamin(i).first_name);
end loop;
end;


declare
type namearray is varray(5) of varchar2(50);
names namearray;
total integer;
begin
names:=namearray('alamin','faysal','kajol');
--total:=names.count;
--dbms_output.put_line('total '||total||' students ');
for i in 1..3 loop
dbms_output.put_line('students '||names(i));
end loop;
end;

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন