谢谢你帮我。第一个插入工作正常,但第二个没有插入任何东西。你能帮帮我吗。我正在学习plsql,但仍有一些事情我不知道。
PROCEDURE PR_INS_INVESTIGATION (
PIN_INS_INVESTIGATION IN IN_INS_INVESTIGATION)
IS
LST_INS_INVESTIGATED RC_INS_INVESTIGATED;
EX_NO_DATA EXCEPTION;
BEGIN
INSERT INTO PQR076INVESTIGATION (CCPQR076IDINVESTIGATION,
CCPQR076DATE,
CCPQR076AREA,
CCPQR076STATE,
CCPQR076USER)
VALUES (PIN_INS_INVESTIGATION.IDINVESTIGACION,
SYSDATE,
PIN_INS_INVESTIGATION.AREA,
PIN_INS_INVESTIGATION.STATE,
USER);
COMMIT;
IF LST_INS_INVESTIGATED IS NOT NULL
AND LST_INS_INVESTIGATED.COUNT > 0
THEN
FOR j IN LST_INS_INVESTIGATED.FIRST .. LST_INS_INVESTIGATED.LAST
LOOP
INSERT INTO PQR075INVESTIGATED (CCPQR075IDINVESTIGATION,
CCPQR075NIDENT,
CCPQR075NAME,
CCPQR075USER)
VALUES (PIN_INS_INVESTIGATION.IDINVESTIGAtION,
LST_INS_INVESTIGATED (J).NUMBERID,
LST_INS_INVESTIGATED (J).NAME,
USER);
COMMIT;
END LOOP;
END IF;
END;这就是我测试程序的方法:
“”
declare
pin_ins_investigation in_ins_investigation;
begin
pin_ins_investigation := in_ins_investigation();
pin_ins_investigation.IDinvestigation := '1234460';
pin_ins_investigation.AREA := '05';
pin_ins_investigation.STATE := 'E';
pin_ins_investigation.LST_INS_investigated.extend;
pin_ins_investigation.LST_INS_investigated(1).NUMBERID := '1014350360';
pin_ins_investigation.LST_INS_investigated(1).NAME := 'PETER TOSH';
pkg_package.pr_ins_investigation(pin_ins_investigation => pin_ins_investigation);
end;“”
发布于 2022-08-12 06:08:46
在我看来,这个:
IF LST_INS_INVESTIGATED IS NOT NULL
AND LST_INS_INVESTIGATED.COUNT > 0不为真,因此IF - END IF块中的任何内容都不会被执行。
你宣布它是
LST_INS_INVESTIGATED RC_INS_INVESTIGATED;但是lst_ins_investigated不包含任何东西,它只是声明,从来没有填充任何值。一旦您修复了它,代码可能会工作。
https://stackoverflow.com/questions/73328144
复制相似问题