【发布时间】:2021-03-22 21:23:01
【问题描述】:
如何用嵌套表参数编写程序?在表测试中,我需要从循环中插入数据,例如。 1,2,3...
plsql
Declare
TYPE code_nt is table of varchar2(10);
l_codes code_nt := code_nt();
begin
FOR i IN 1..APEX_APPLICATION.G_F01.COUNT LOOP
l_codes.extend;
l_codes(i) := to_char(i);
END LOOP;
//here call procedure
//PKG_EMP.INSERT_EMP(PAR_1);
end;
包装:
create or replace PACKAGE PKG_EMP AS
TYPE code_nt is table of varchar2(10);
l_codes code_nt := code_nt();
procedure INSERT_EMP (PAR_1 code_nt);
END;
create or replace PACKAGE BODY PKG_EMP AS
procedure INSERT_EMP (PAR_1 code_nt) AS
BEGIN
INSERT INTO test (ID) VALUES (value from code_nt);
END;
end;
【问题讨论】:
-
@MT0 给了你答案。请注意,在您的包中声明包变量
l_codes可能没有意义。只需在此处声明类型并在需要的地方声明该类型的变量即可。 -
@JustinCave 你能在回答中描述一下吗? Tnx!
标签: oracle plsql oracle-apex