// 创建存储过程
create or replace
procedure test as
--申明数组类型
type t_test is table of varchar2(9);
test t_test:=t_test('A','B','C','D','E','F','G','H','J','K','L');
begin
--遍历数组,将遍历得到的数据插入到AA表中
for i in 1 .. test.count loop
DBMS_OUTPUT.PUT_LINE('i='|| i || ', table_names= ' ||t_test(i));
end loop;
WHILE test(i)='A' loop
insert into AA(hongyan) values('AAAA');
END LOOP;
insert into AA(hongyan) values(test(i));
end;
commit;
调用存储过程
call test()
;
execute immediate
oracle存储过程中数组申明和遍历
最新推荐文章于 2024-08-10 09:37:44 发布