oracle pl/sql recode type记录组的使用
declare
type rec_type is record (stk_c varchar2(32));
type tab_type is table of rec_type index by binary_integer;
my_table tab_type;
cn number := 0;
v_dup number := 0;
begin
for cr in (select a1, a2 from a)loop
cn := cn + 1;
if cn > 1 then
for i in 1…my_table.count loop
if my_table(i).stk_c = cr.a1 then
v_dup := i;
exit;
end if;
end loop;
dbms_output.put_line('line '||v_dup||' = line '||cn);
else -- cn = 1
my_table(cn).stk_c := cr.a1;
end if;
end loop;
if v_dup = 0 then
dbms_output.put_line(‘no duplicate lines’);
end if;
end;